UserGuide PDF
UserGuide PDF
Before using the information in this manual, be sure to read the “Notices” section of the Help or
the PDF available from Help > List of Books.
This edition applies to IBM® Rational® Rhapsody® 7.5 and to all subsequent releases and
modifications until otherwise indicated in new editions.
ii
Contents
iv User Guide
Table of Contents
Hyperlink limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Create a diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Creating a diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Create a Rational Rhapsody project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Creating a Rational Rhapsody project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Import a Rational Rhapsody project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Importing a Rational Rhapsody project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Import source code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Importing source code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Search window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Graphic editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Call stack and event queue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Rational Rhapsody v
Table of Contents
vi User Guide
Table of Contents
Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Rational Rhapsody properties overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Property groups and definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Subjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Metaclasses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Regular expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Regular expression syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Parsing regular expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Property file format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Rational Rhapsody keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Predefined variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Map custom properties to keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Rational Rhapsody properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Using the Properties tab in the Features window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
PRP files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Property inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Concepts used in properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Static architectures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
IncludeFiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Selective framework includes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Reactive classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Units of collaboration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
The Executer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Rational Rhapsody environment variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Format properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Defining default characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Defining line characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Rational Rhapsody ix
Table of Contents
x User Guide
Table of Contents
Rational Rhapsody xi
Table of Contents
Rational Rhapsody xv
Table of Contents
Statecharts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725
States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726
xx User Guide
Table of Contents
Nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 873
Creating a node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 873
Changing the owner of a node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 874
Designating a CPU type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 874
Features of nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 874
Component instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 875
Adding a component instance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 875
Moving a component instance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 877
Features of component instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 877
Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 878
Adding a dependency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 878
Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 879
Assigning a package to a deployment diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 880
Checks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 881
Checker features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 881
The Checks tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 882
Specifying which checks to run. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 884
Checking the model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 885
Checks tab limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 885
User-defined checks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 886
Creating user-defined checks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 886
Removing user-defined checks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 887
Deploying user-defined checks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 888
External checks limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 888
List of Rational Rhapsody checks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 889
Roundtripping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1047
Supported elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1048
Roundtripping limitations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1048
Dynamic Model-code Associativity (DMCA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1049
The roundtripping process. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1050
Automatic and forced roundtripping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1050
Roundtripping classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1050
Modifying code segments for roundtripping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1051
Recovering lost roundtrip annotations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1052
Roundtripping classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1053
Roundtripping packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1055
Roundtripping deletion of elements from the code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1057
Roundtripping for C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1058
Roundtripping for Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1059
Roundtripping properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1059
Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1079
Animation Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1080
Animation Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1080
Preparing for Animation - General Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1080
Create a Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1081
Creating a component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1081
Setting the Component Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1082
Creating a Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1083
Setting the Instrumentation Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1084
Running the Animated Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1086
Running on the Host . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1086
Running on a Remote Target . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1087
Opening a Port Automatically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1088
Testing an Application on a Remote Target . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1088
Testing a Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1089
Partially Animating a Model (C/C++) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1089
Setting Elements for Partial Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1090
Partial Animation Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1090
Partially Animated Sequence Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1091
Ending an Animation Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1092
Animation Toolbar. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1093
Creating Initial Instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1094
Break Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1095
Command Prompt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1095
Generating Events Using the Animation Command Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1095
Events with Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1096
Generating Events Using the Command History List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1097
Threads. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1098
Thread View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1098
Setting the Thread Focus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1098
Names of Threads. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1099
Notes on Multiple Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1099
Active Thread Properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1100
AnimSerializeOperation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1138
AnimUnserializeOperation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1140
Running an Animated Application Without Rational Rhapsody . . . . . . . . . . . . . . . . . . . . . . . . 1141
Tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1143
Tracer Capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1143
Starting a Trace Session. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1144
Controlling Tracer Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1145
Accessing Tracer Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1145
Tracer Commands and an Input File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1145
Threads in Tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1147
Tracer Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1148
break . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1148
CALL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1151
display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1153
GEN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1153
go . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1154
help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1155
input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1155
LogCmd. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1156
output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1157
quit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1157
resume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1158
set focus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1158
show . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1159
suspend. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1162
timestamp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1162
trace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1162
watch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1166
Tracer Messages by Subject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1167
Ending a Trace Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1169
Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1195
ReporterPLUS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1195
Launching ReporterPLUS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1196
ReporterPLUS templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1196
Generating reports using existing templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1200
Viewing reports online . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1201
Generating a list of specific items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1201
Using the system model template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1201
The internal reporting facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1203
Producing an internal report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1203
Setting the RTF character set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1205
Using the internal report output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1205
xl User Guide
Table of Contents
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1531
Systems engineers and software developers use Rational Rhapsody to create either embedded or
real-time systems. However, Rational Rhapsody goes beyond defining requirements and designing
a software solution. Rational Rhapsody actually implements the solution from design diagrams
and automatically generating ANSI-compliant code that is optimized for the most widely used
target environments.
With Rational Rhapsody, you have the ability to analyze the intended behavior of the application
much earlier in the development cycle by generating code from UML and SysML diagrams and
testing the application as you create it. Rational Rhapsody can be used for any of the following
items:
Rational Rhapsody 1
Introduction to Rational Rhapsody
Rational Rhapsody translates these diagrams into source code in one of four high-level languages:
C++, C, Ada, or Java. Rational Rhapsody then allows you to edit the generated code and
dynamically roundtrip the changes back into the model and its graphical views. Rational Rhapsody
supplies four editions to create specific types of projects depending on your job requirements.
Rational Rhapsody Developer edition (C, C++, Java, and Ada are available, and this
edition required for Eclipse users.)
Rational Rhapsody Architect for Software edition (described in Creating projects in
Rational Rhapsody Architect for Software)
Rational Rhapsody Architect for Systems Engineers edition (described in Creating projects
in Rational Rhapsody Architect for Systems Engineers)
Rational Rhapsody Designer for Systems Engineers edition (described in Creating projects
in Rational Rhapsody Designer for Systems Engineers)
Only one Rational Rhapsody edition can be selected during installation.
2 User Guide
UML design essentials
Integration with leading IDEs such as Eclipse, Wind River® Workbench, and Green Hills®
Multi®.
Dynamic model-code associativity enabling design to be done using either code or
diagrams providing maximum flexibility while ensuring the two remain synchronized.
Improved test productivity and early detection of defects using Rational Rhapsody
TestConductor™ to automate tedious testing tasks, define tests with code and graphically
with sequence diagrams, statecharts, activity diagrams and flowcharts; and execute the
tests interactively or in batch mode.
XMI* (XML Metadata Interchange) and IBM® Rational Rose®* importing for integration
of legacy systems and reuse of existing code.
Full Configuration Management Interface* support with advanced graphical difference
and merging capabilities for use with tools such as IBM® Rational® Synergy™ or IBM®
Rational® ClearCase®.
Support for software product lines using class and object variants for components
Customization to meet your specific development needs using the Java API.
Generation of documentation using a range of tools, from a simple RTF report generator to
the full customization with Rational® Rhapsody® ReporterPLUS™.
* Capabilities are provided by optional add-ons.
The Unified Modeling Language (UML) is a third-generation modeling language for describing
complex systems. The Object Management Group® (OMG®) adopted the UML as the industry
standard for describing object-oriented systems in the fall of 1997. For more information on the
OMG, see their Web site at http://www.omg.org.
UML defines a set of diagrams by which you can specify the objects, messages, relationships, and
constraints in your system. Each diagram emphasizes a different aspect or view of the system
elements. For example, a UML sequence diagram focuses on the message flow between objects
during a particular scenario, whereas an object model diagram defines classes, their operations,
relations, and other elements.
Rational Rhapsody 3
Introduction to Rational Rhapsody
UML diagrams
The UML specification includes the following diagrams:
Use case diagram shows typical interactions between the system being designed and
external users or actors. Rational Rhapsody can generate code for actors in use case
diagrams to be used for testing a model.
Object model diagram shows the static structure of a system: the objects in the system
and their associations and operations, and the relationships between classes and any
constraints on those relationships.
Sequence diagram shows the message flow of objects over time for a particular scenario.
Collaboration diagram provides the same information as a sequence diagram but
emphasizes structure, whereas a sequence diagram emphasizes time.
Statechart defines all the states that an object can occupy and the messages or events that
cause the transition of the object from one state to another.
Activity diagram specifies a workflow or process for classes, use cases, and operations.
Activity diagrams provide similar information to statecharts, but are better for linear
step-by-step processes, whereas statecharts are better suited for non-linear or event-driven
processes.
Component diagram describes the organization of the software units and the
dependencies among these units.
Deployment diagram depicts the nodes in the final system architecture and the
connections between them. Nodes include processors that execute software components,
and the devices that those components control.
Structure diagram models the structure of a composite class; any class or object that has
an OMD can have a structure diagram. Object model diagrams focus more on the
specification of classes, whereas structure diagrams focus on the objects used in the
model.
In addition, a Flow Chart is available in the Rational Rhapsody product. You can use a flow chart
to describe a function or class operation and for code generation.
4 User Guide
UML design essentials
UML views
You can use Rational Rhapsody to draw UML diagrams that provide different views of your
system. By editing the UML diagrams in Rational Rhapsody to create increasingly complex views,
you can add layers of perspective, detail, and specificity to your model until you have a complete
solution.
Structural views
Structural views show model elements and their relationships to each other. Model elements
include classes, use cases, components, and actors; their relationships include dependencies,
inheritances, associations, aggregation, and composition.
The following UML diagrams provide dynamic behavior views of the model:
Statechart
Activity diagram
Sequence diagram
Collaboration diagram
Rational Rhapsody 5
Introduction to Rational Rhapsody
Note
Rational Rhapsody diagrams have varying levels of code generation ability. Model elements
and implementation code can also be created from the browser.
Because Rational Rhapsody maintains a tight model-code associativity, you can easily generate
updated code when you make changes to the model. You can also edit code directly and bring
those changes into the model via the roundtrip feature. For more information about model-code
associativity, see Basic code generation concepts.
6 User Guide
Development methodology
Development methodology
A development methodology is a combination of a process, a tool, and a modeling language.
Rational Rhapsody is a UML-compliant modeling tool that is process-neutral and supports the
most common phases of any good development methodology. However, Rational Rhapsody is
particularly well-suited to an iterative process in which you build a number of model prototypes,
test, debug, reanalyze, and then rebuild the model any number of times, all within a single
development environment.
The ROPES™ process is an example of an iterative process that illustrates the use of Rational
Rhapsody and the UML across all typical process phases and activities. The following sections
provide a general overview of the phases involved in the ROPES process (including the subtasks
involved in general analysis, design, implementation, and test phases) and the Rational Rhapsody
tools appropriate for each phase. The Web site for IBM Rational modeling products contains
detailed information on ROPES.
Analysis
In the analysis phase, you define a problem, its possible solutions, and their characteristics.
Requirements analysis
Begin with the requirements analysis to identify the system requirements. What are the primary
system functions or system usages? Use case diagrams can capture these along with the external
actors that interact with the system.
Describe the expected behavior of the system as a whole by creating a series of “black-box”
sequence diagrams. In these, you will define the sequence of messages between external actors and
the system as a whole. You can create a number of sequence diagrams for each use case, where
each sequence diagram represents one scenario that could occur while carrying out that use case.
You can also use collaboration diagrams to specify the expected behavior of the system.
Rational Rhapsody 7
Introduction to Rational Rhapsody
Use the black-box sequence diagrams as the basis for creating statecharts, which realize all
possible scenarios. Statecharts specify the behavior of each object, or object implementation, as
opposed to sequence diagrams, which concentrate on requirements-based scenarios. Sequence
diagrams also serve as the primary test data in the testing phase; in later stages, use them to test
whether your system as a whole responds properly to the external messages that come into it. You
can also use activity diagrams to realize all possible scenarios. To review and analyze the
requirements in your project, you can use the advanced search facility and the table and matrix
tools.
Object analysis
While you are capturing system requirements, you should also define the entities and structural
relationships that will exist in the application you are creating and its domain or environment. This
should result in a structural (static) model of the system (a logical object model of the system).
Determine the subsystems of your system. What are their responsibilities and relationships? These
subsystems become the basis of the packages, or collections of classes, within your system.
Determine the key objects or classes in these subsystems and define their responsibilities,
descriptions, and their relations to other classes. Use object model diagrams to create these classes
and their relations. Using sequence diagrams and statecharts, define the behavior and interactions
of these essential objects.
You can also use the code generation and animation tools to execute and debug these higher-level
analysis models.
Design
In the analysis phase, you came up with several possible solutions to your problem. In the design
phase, you choose one of those solutions and define how it will be implemented. As with the
analysis phase, the design phase has more than one component. Just as the analysis phase should
conclude with some result, a full set of use cases and a logical object model of the system, the
design phase should also provide results: task and deployment models, and more refined logical
object models.
Architectural design
Define the major architectural pieces of the system. What are the high-level parts? Define what the
system domains are and which key classes fit in each domain. Which are your composite classes?
In this analysis, you should also map classes, packages, and components to the relevant physical
parts of your system (the processors and devices). Define which libraries and executables are
necessary in your model. You are creating the task and deployment models for your system. To
help with this, you can apply UML design patterns as appropriate for your system.
8 User Guide
Development methodology
Mechanistic design
Continue to detail the internal workings of your system, breaking it down into smaller pieces and
more classes, if necessary. Use “white-box” sequence diagrams to depict the class interactions
within the system. Define the collaborations that are required to realize certain core cases by
creating collaboration diagrams. Add to your model the “glue” objects that are used in the UML
design patterns that you use. Again, you can use the code generation and animation tools to debug
and test the model at this point. Your end result should be a more refined set of logical object
models.
Detailed design
Continue to fill in the details of your design. Get your individual classes working; fully define their
constraints, internal data structures, and message passing behavior. Use activity diagrams and
statecharts to define correct behavior. At this stage, you will probably begin typing in extra code in
the implementation boxes in various diagrams. Use component diagrams to define the physical
artifacts of your system and to include the libraries, executables, or legacy code you have deemed
necessary for your model. Make low-level decisions about implementations, such as choosing
static or dynamic instantiations. This should result in a more refined logical object model (or
models) of your system.
Implementation
The implementation phase is essentially the code generation and unit testing phase. Using Rational
Rhapsody, write the code that is not generated automatically, such as the bodies of non-statechart
operations. These include constructors, destructors, object methods, and global functions. Use the
animation and tracing tools to test and debug sections of code and to make decisions about any
optimization
trade-offs.
Rational Rhapsody includes the following features to assist with the testing phase:
Animator creates test scripts to apply external test stimuli to the system.
Tracer performs white, gray, and black-box regression testing. It also provides
performance testing based on timing annotations or on a simulated time facility.
Sequence diagram comparison Automatically compares requirement sequences with
implementation sequences.
Rational Rhapsody 9
Introduction to Rational Rhapsody
Graphic editors
Code generator
Animator
Utilities, including reverse engineering, Web-enabling devices, XMI generation, COM and
CORBA® support, and Visual Basic® for Applications
Third-party interfaces such as Eclipse, Rational Rose import, and CM tools
For more details about the uses of the browser, see Browser and Browser filter; and for details on
the model display features for the browser, see Browser techniques for project management.
10 User Guide
Rational Rhapsody tools
Your favorites list is saved in the <projectname>.rpw file, as well as the position and visibility of
the Favorites browser, so that when you open the project the next time, your settings are
automatically in place. Note that when multiple projects are loaded, the Favorites browser shows
the favorites list for the active project, as described in Setting the active project.
For more information about the Favorites browser, see The Favorites browser.
Rational Rhapsody 11
Introduction to Rational Rhapsody
Diagram tools
When you have a diagram open on the drawing area in Rational Rhapsody, a panel of diagram
drawing tools for the currently displayed diagram type also appears. You can move this panel to
different locations and close it.
Different tools are available depending on the type of diagram displayed in the drawing area.
This accordion menu also contains a Common section for tools for common additions to diagrams
and a Free Shapes section for tools that let you draw elements freehand in a diagram.
12 User Guide
Rational Rhapsody tools
Graphic editors
You can use the graphic editors to analyze, design, and construct the system using UML diagrams.
Diagrams enable you to observe the model from several different perspectives, like turning a cube
in your hand to view its different sides. Depending on its focus, a diagram might show only a
subset of the total number of classes, objects, relationships, or behaviors in the model. Together,
the diagrams represent a complete design.
Rational Rhapsody adds the objects created in diagrams to the Rational Rhapsody project, if they
do not already exist. Conversely, Rational Rhapsody removes elements from the project when they
are deleted from a diagram. However, you can also add existing elements to diagrams that do not
need to be added to the project, and remove elements from a diagram without deleting them from
the model repository.
Use case diagram editor provides tools for creating use case diagrams, which show the
use cases of the system and the actors that interact with them. See Use case diagrams.
Object model diagram editor provides tools for creating object model diagrams, which
are logical views showing the static structure of the classes and objects in an object-
oriented software system and the relationships between them. See Object model diagrams.
Sequence diagram editor provides tools for creating sequence diagrams, which show
interactions between objects in the form of messages passed between the objects over
time. If you run animated code with the Animator, you can watch messages being passed
between objects as the model runs. See Sequence diagrams.
Collaboration diagram editor provides tools for creating collaboration diagrams, which
describe how different kinds of objects and associations are used to accomplish a
particular task. Collaboration diagrams and sequence diagrams are both interaction
diagrams that show sequences. Sequence diagrams have a time component, whereas
collaboration diagrams do not.
Like sequence diagrams, collaboration diagrams show the message flow between
different classes. However, collaboration diagrams emphasize object relationships
whereas sequence diagrams emphasize the order of the message flow. For a particular task
or interaction, a collaboration diagram can also show the individual objects that are
created, destroyed, or exist continuously for the duration of the task. See Collaboration
diagrams.
Statechart editor provides tools for creating statecharts, which define the behaviors of
individual classes in the system.
Statecharts show the states of a class in a given context, events that can cause transitions
from one state to another, and actions that result from state transitions. Rhapsody
generates function bodies from information entered into statecharts. If you run animated
code with the animator, you can watch an object change states as it reacts to various
messages, events, and triggered operations that you generate. See Statecharts
Rational Rhapsody 13
Introduction to Rational Rhapsody
Activity diagram editor provides tools for creating activity diagrams. Activity diagrams
show the lifetime behavior of an object, or the procedure that is executed by an operation
in terms of a process flow, rather than as a set of reactions to incoming events. When a
system is not event-driven, use activity diagrams rather than statecharts to specify
behavior. See Activity diagrams.
Component diagram editor provides tools for creating component diagrams, which
show the dependencies among software components, such as library or executable
components. Component diagrams can also show component dependencies, such as the
files (or other units) that are contained by a component, or the connections or interfaces
among components. See Component diagrams.
Deployment diagram editor provides tools for creating deployment diagrams, which
show the run-time physical architecture of the system. The physical architecture of a
running system consists of the configuration of run-time processing elements and the
software components, processes, and objects that live on them. A deployment diagram
graphs the nodes in the system, representing various processors, connected by
communication associations. See Deployment diagrams.
Structure diagram editor provides tools for creating structure diagrams, which model the
structure of a composite classes. See Structure diagrams.
Note
All the diagrams use UML notation.
The FunctionalC profile has these diagrams available to construct a C model:
14 User Guide
Rational Rhapsody tools
Code generator
The code generator synthesizes complete production-quality code from the model to free you from
low-level coding activities. Rational Rhapsody generates code primarily from OMDs and
statecharts, but also from activity and other diagrams. Allowing the tool to generate code
automatically for you lets you concentrate on higher-level system analysis and design tasks. For
more information, see Basic code generation concepts.
Animator
The animation facility lets you debug and verify your software at the design level rather than the
compiler level. For more information, see Animation.
Utilities
In addition to the core UML-based design features, Rational Rhapsody provides a number of
utilities to assist with development including the following utilities:
Rational Rhapsody 15
Introduction to Rational Rhapsody
Third-party interfaces
The following third-party software interfaces can be accessed through the Rational Rhapsody
interface:
Configuration management tools including support for the Microsoft Source Code Control
(SCC) standard
Visual Studio standard or professional edition (see Visual Studio IDE with Rational
Rhapsody)
Integrated VBA Interface for development and macros
IDE interface to the Tornado™ development environment (see Co-debugging with
Tornado)
16 User Guide
Rational Rhapsody windows
Menu bar lists the primary functions as File, Edit, View, Code, Tools, Layout, Windows,
and Help. Many of the Rational Rhapsody functions available on the menus are also
accessible from Rational Rhapsody shortcuts and buttons across the top of the Rational
Rhapsody interface, as described in Rational Rhapsody project tools.
Browser displays the contents of the project and has several views to choose from. See
Browser.
Diagram drawing area contains the diagram editor windows, which can be moved and
resized. See Diagram drawing area.
Diagram Tools contains the drawing tools for each diagram type and opens in a panel next
to the diagram open in the drawing area in Rational Rhapsody. See Diagram tools.
Different buttons are displayed in the panel depending on the type of diagram displayed in
the drawing area. See the descriptions of the diagrams for explanations of each diagram
drawing tool. This accordion menu also contains a Common section for tools for
common additions to diagrams and a Free Shapes section for tools that let you draw
elements freehand in a diagram.
Diagram Navigator provides a bird’s eye view of the diagram that is currently displayed.
See Diagram navigator.
Output window has several tabs, each displaying different types of Rational Rhapsody
output including search results. See Output window.
In addition, you can open two windows from the View menu:
Rational Rhapsody 17
Introduction to Rational Rhapsody
The following figure shows the default arrangement of the Rational Rhapsody windows.
You can reposition each window within the Rational Rhapsody workspace to suit your
preferred work style.
To dock or undock a window quickly, double-click the title bar.
To reposition a window, click the title bar and drag-and-drop the window to the intended
location.
18 User Guide
Rational Rhapsody windows
Rational Rhapsody 19
Introduction to Rational Rhapsody
20 User Guide
Rational Rhapsody windows
Rational Rhapsody 21
Introduction to Rational Rhapsody
Browser
The browser displays a hierarchy of your project and provides easy access to the elements and
diagrams it contains. You can filter the display with several view options. Browser techniques for
project management provides detailed descriptions of browser elements and views.
By default, the browser is docked at the upper, left corner of the Rational Rhapsody main window.
Move them to another browser element by dragging and dropping them over the target
element
Copy them to another browser element by dragging and dropping them over the target
element
Delete all of them at the same time
22 User Guide
Rational Rhapsody windows
Each diagram includes a title bar, which contains the name of the diagram and its type. A modified
diagram has an asterisk (*) added to the end of its name in the title bar.
For a description of the graphic editor windows, see Graphic editors. For a description of the
default code editor, see The Internal code editor.
Rational Rhapsody 23
Introduction to Rational Rhapsody
Diagram navigator
The Diagram Navigator provides a bird's eye view of the diagram that is currently being viewed.
This can be very useful when dealing with very large diagrams, allowing you to view specific
areas of the diagram in the drawing area, while, at the same time, maintaining a view of the
diagram in its entirety.
The Diagram Navigator contains a depiction of the entire diagram being viewed, and a rectangle
viewport that indicates which portion of the diagram is currently visible in the drawing area.
For detailed information about using the Diagram Navigator window, see The Bird’s Eye (diagram
navigator).
Output window
The Output window is where Rational Rhapsody displays various output messages. You can use
the tabs on the Output window to navigate easily among the different types of output messages:
The Log tab shows all the messages from all the other tabs of the Output window (except
for Search Results) in text (meaning non-tabular) format.
The Build tab shows the messages related to building an application in tabular format.
The Check Model tab shows the messages related to checking the code for a model in
tabular format.
The Configuration Management tab shows the messages related to configuration
management actions for a model in text format.
The Animation tab shows the message related to animating a model in text format.
The Search Results tab shows the results from searches of your model in tabular format.
Note that this tab might not appear until you perform a search.
By default, the Output window is located at the bottom portion of the main Rational Rhapsody
window. Also by default, when you generate, build, or run an application; do a search, a CM
action, or a check model, Rational Rhapsody opens the Output window.
24 User Guide
Rational Rhapsody windows
Log tab
The Log tab serves as a console log. It shows all the messages from all the other tabs of the Output
window (except for Search Results) in text (meaning non-tabular) format. The messages that
appear on the Check Model, Build, Configuration Management, and Animation tabs appear on
the Log tab too, but always in text format. For the check model and build functions, you can view
their messages on the Check Model and Build tabs in tabular format or on the Log tab in text
format, depending on your preference. The Log tab displays messages in text format after a build
function is performed.
Note that you can right-click on the Log tab to use the Clear, Copy, Paste, and Hide commands.
The following figure shows the Build tab for the same build function. As you can see, the
messages provide the same type of information, though the presentation is in a tabular format.
On the Log, Check Model, and Build tabs, you can double-click an item on the tab and, if
possible, Rational Rhapsody opens either the relevant model element (for example, the Features
window for an association that might be causing an error) or to the code source. From whichever
opens, you can make corrections or view the item more closely.
Rational Rhapsody 25
Introduction to Rational Rhapsody
Before generating code, Rational Rhapsody automatically performs certain checks for the
correctness and completeness of the model. In addition, you can perform selected checks at any
time during the design process. To check the code for a model, choose Tools > Check Model and
then the name of the configuration for the model. For more information about checking the code
for a model, see Checks.
26 User Guide
Rational Rhapsody windows
The following table explains what type of information available on the Check Model tab.
Column Explanation
Checks Shows the check results tree grouped by three levels and in the hierarchy
shown as follows:
Level 1, Severity: Where the elements listed are grouped under the three
optional severity levels as follows:
Errors
Warnings
Info
The grouping is determined by the severity level of each added check. If there
is a + icon next to a label, click it to expand or collapse the list. In addition, to
the right of each severity level name is the number of problems in the security
level.
Level 2, Checks: Where each check that produces errors/problems when it is
executed is shown in the list indented under its relevant severity level (for
example, Default Names under Warnings). A check is considered a group that
holds under it all its related problems. Each check in the list shows also its
domain and integrity properties. In addition, to the right of each check name is
the number of problems the check contains. There are 10 Default Name
warnings.
Level 3: Check Elements, where each problem found when performing a
specific check is shown as a list item under the relevant check name. Problems
are represented by model elements and shown with the relevant name, type
icon, and model location path (for example, ServicePerson:
itsServiceDishwasher, the first item in the Default Names check group in the
Warnings severity level).
Location Shows, for each problem found, the location of an element in the model.
Domain Shows, for each check in the list, its domain property. This includes domains
that are from user-defined checks.
Integrity Shows, for each check in the list, its integrity property value.
Rational Rhapsody 27
Introduction to Rational Rhapsody
You can double-click an item on the Check Model tab and if possible, Rational Rhapsody brings
you to the relevant model element (for example, the Features window for an association) or to the
code on which you can make corrections or view the item more closely. Note that if you click a
level heading, you expand or collapse the list for the level.
Note that you can right-click on the Check Model tab to use the Copy All and Clear All
commands.
28 User Guide
Rational Rhapsody windows
Build tab
The Build tab shows the messages related to building an application.
Column Explanation
Severity Error messages. Errors appear when the model fails to build. You must fix
errors before the model can be built. Rational Rhapsody parses the information
provided by the compiler to develop the list of error messages. Note that there
can be two types of error (and warning) messages: model element and code
error. Model element-type errors (and warnings) are those that Rational
Rhapsody can correspond to specific model elements in a project. Code error-
type errors are those that Rational Rhapsody cannot find any corresponding
model element.
Warning messages. Warnings have no effect on whether the model is built, but
you should review them and address them if necessary as they might have an
effect on whether the model builds as expected. Rational Rhapsody parses the
information provided by the compiler to develop the list of warning messages.
Informational messages. These messages are messages that are not warnings
or errors and they have no effect on the building of the model.
Model Element Applicable to error and warning messages only, shows the Rational Rhapsody model
element and its applicable Rational Rhapsody icon. If no related model element is
found, the error is assumed to be a code error-type error.
File Applicable to error and warning messages only, shows the file name and line number
where an error/warning was found.
Description Descriptions are provided by the compiler.
More Details Applicable to error and warning messages only, and only if available, show more
details as provided by the compiler.
Rational Rhapsody 29
Introduction to Rational Rhapsody
By default, you see all the messages for a build. If this is not the case, you can select All Build
Messages View from the menu in the upper-left corner of the Output window for the Build tab.
You can use the menu in the upper-left corner of the Output window for the Build tab to choose
other views. The following figure shows the Build tab with Model Element Messages selected,
which shows only items with a severity of Error or Warning that also have references to a model
element. In addition, information messages, code error-type errors and warnings are filtered out.
The following figure shows the Build tab with All Errors and Warnings View selected, which
shows only error and warning messages (so that information messages are filtered out).
30 User Guide
Rational Rhapsody windows
Note that you can double-click an item on the tab and, if possible, Rational Rhapsody opens either
the relevant model element (for example, the Features window for an association that might be
causing an error) or to the code source. From whichever opens, you can make corrections or view
the item more closely. In the following figure, double-clicking the “Code Error” item on the Build
tab in the lower portion of the figure, opens the code for that item in the upper-right portion of the
figure.
You can right-click the Build tab to use the Copy All and Clear All commands.
Note
By default, the Build tab displays after you run a build. If you want the Log tab to
automatically display instead after a build, you can set the
CG::General::ShowLogViewAfterBuild property to Checked.
Supported compilers
The compilers from Microsoft, Java, and Cygwin are fully supported, which means that Rational
Rhapsody is able to analyze the output from their compilers and show the correct severity levels
for their messages. For all other compilers, their output will only show Informational messages.
Rational Rhapsody 31
Introduction to Rational Rhapsody
Animation tab
The Animation tab shows messages related to animating a model. For more information about
animation, see Animation. You can right-click on the Animation tab to use the Clear, Copy,
Paste, and Hide commands.
32 User Guide
Rational Rhapsody project tools
To open the Active Code View window, choose View > Active Code View.
Specification tab
The Active Code View window has two tabs, Specification and Implementation. The
Specification tab displays the specification code.
Implementation tab
The Active Code View window has two tabs, Specification and Implementation. The
Implementation tab displays the implementation code.
Welcome window
Rational Rhapsody typically starts up with the Welcome window open. The Welcome window
provides links to help you get started quickly. The Welcome Screen appears each time you open
Rational Rhapsody unless you clear the Show Welcome Screen at startup check box at the
bottom of the window. You can view the Welcome window at any time by choosing Help >
Welcome Screen.
If Rational Rhapsody starts up without opening the Welcome window, choose Help >
Welcome Screen. Notice that doing this automatically selects the Show Welcome Screen
at startup check box at the bottom of the window.
If you have cleared the Show Welcome Screen at startup check box but have not yet shut
down Rational Rhapsody, return to the Welcome window (select the Welcome tab in the
drawing area or choose Help > Welcome Screen) and select the Show Welcome Screen
at startup check box.
Rational Rhapsody 33
Introduction to Rational Rhapsody
disabled or not displayed, the operation represented by the button is unavailable for the currently
displayed project items.
Browser filter
The browser filter lets you display only the elements relevant to your current task. Click the down
arrow at the top of the browser to display the menu of filter options.
The filter is set to Entire Model View (default). For detailed information about the other options,
see Rational Rhapsody browser menu options. You can also display the browser filter using View >
Toolbars > Browser Filter.
34 User Guide
Rational Rhapsody project tools
Standard tools
The Standard toolbar provides quick access to the standard tools in Rational Rhapsody. To
display or hide this toolbar, choose View > Toolbars > Standard.
Tool
Name Description
Button
New Creates a project. This button executes the same command as File > New.
Open Opens an existing project. This button executes the same command as File > Open.
Save Saves the current project. This button executes the same command as File > Save.
Cut Cuts the selection to the clipboard. This button executes the same command as
Edit > Cut.
Copy Copies the selection to the clipboard. This button executes the same command as
Edit > Copy.
Paste Pastes the contents of the clipboard. This button executes the same command as
Edit > Paste.
Format Painter Used for copying formatting from one element to another element in the same
diagram.
Print Prints the active view. This button executes the same command as File > Print.
About Opens the About Rational Rhapsody window, which displays the product version
information. You can also choose Help > About Rhapsody to open the window. In
addition, when you have the About Rhapsody window open, you can click the
License button to open the License Details window.
Undo Undoes the last operation you performed in the model. This button executes the
same command as Edit > Undo.
Redo Reverses the undo command. This button executes the same command as Edit >
Redo.
Search Opens the Search window for a term in the model. This button executes the same
command as Edit > Search.
Rational Rhapsody 35
Introduction to Rational Rhapsody
Tool
Name Description
Button
References Opens a list of elements that reference the selected element.
This button executes the same command as right-clicking the selected element in
the browser and selecting References.
Locate in Locates the selected diagram element in the browser.
Browser This button executes the same command as the Locate button in the Features
window and Edit > Locate in Browser.
Delete Deletes the current selection from model. This button executes the same command
as Edit > Delete.
36 User Guide
Rational Rhapsody project tools
Run Executable Runs the executable image. This button executes the same
command as Code > Run XXX.exe.
Rational Rhapsody 37
Introduction to Rational Rhapsody
38 User Guide
Rational Rhapsody project tools
Tool
Name Description
Button
Browser Toggles between showing and hiding the browser.
Show/Hide Toggles between showing and hiding the Features window for the current element.
Features
Show/Hide Toggles between showing and hiding the Active Code View window.
Active Code
View
Show/Hide Toggles between showing and hiding the Output window.
Output Window
Back Displays the previously displayed window. This operation is also available using
Window > Back.
Forward Displays the window in the opposite direction from Back. This operation is also
available using Window > Forward.
Note
The Back and Forward navigation is unavailable on Linux. This is for Windows systems
only.
Rational Rhapsody 39
Introduction to Rational Rhapsody
For more information about the Favorites browser and about the Favorites toolbar, see The
Favorites browser.
Tool
Name Description
Button
VBA Editor Opens the VBA editor.
Macros Opens the Macros window so you can create VBA macros.
For more information about animation and about this toolbar, see Animation.
40 User Guide
Rational Rhapsody project tools
For information about annotations for diagrams, see Annotations for diagrams.
Tool
Name Description
Button
Note Creates a documentation note. Click the button and use the mouse to draw the note
in the diagram.
This is the type of note available with previous versions of Rational Rhapsody. The
note displays in the diagram, but not in the browser.
Constraint Creates a constraint. This button executes the same command as Edit >
Add New > Constraint.
Comment Creates a comment. This button executes the same command as Edit > Add New >
Comment.
Requirement Creates a requirement. This button executes the same command as Edit >
Add New > Requirement.
For more information about zoom function and the Zoom toolbar, see Zoom.
Rational Rhapsody 41
Introduction to Rational Rhapsody
For more information about the Format toolbar, see Format text on diagrams.
For more information about the Layout toolbar, see Layout toolbar.
For more information about the graphic editors and about these tools, see Graphic editors.
42 User Guide
Creating diagrams
Creating diagrams
The Diagrams drawing buttons access the graphic editor to create and edit diagrams. The Profiles
create a starting point structure for new projects and control which diagrams are available for those
projects. The available diagrams are represented as buttons on the toolbar across the top of the
Rational Rhapsody window.
1. Choose Tools > Diagrams and select the type of diagram you want to create, or click the
diagram button at the top of the Rational Rhapsody window.
2. The Open window for the selected diagram displays. Highlight the portion of the project
with which the diagram will be associated.
3. Click New.
4. In the New Diagram window, enter the Name of the new diagram.
5. If you want to populate the new diagram automatically with existing model elements,
click the Populate Diagram check box.
6. Click OK.
Rational Rhapsody 43
Introduction to Rational Rhapsody
Diagram
Name Description
Button
Object Model This diagram shows the logical views of the static structure of the classes and
Diagram objects in an object-oriented software system and the relationships between them.
This diagram is available for the majority of profiles. Click this button to be able to
open an existing object model diagram or to create one.
Sequence This diagram shows the interactions between objects in the form of messages
Diagram passed between the objects over time. This diagram is available for the majority of
profiles. Click this button to be able to open an existing sequence diagram or to
create one.
Use Case This diagram shows the use cases of the system and the actors that interact with
Diagram them. This diagram is available for the majority of profiles and also the FunctionalC
profile. Click this button to be able to open an existing use case diagram or to create
one.
Component This diagram shows the dependencies among software components, such as library
Diagram or executable components. This diagram is available for the majority of profiles. Click
this button to be able to open an existing component diagram or to create one.
Deployment This diagram shows the run-time physical architecture of the system. This diagram is
Diagram available for the majority of profiles. Click this button to be able to open an existing
deployment diagram or to create one.
Collaboration This diagram describes how different kinds of objects and associations are used to
Diagram accomplish a particular task. This diagram is available for the majority of profiles.
Click this button to be able to open an existing collaboration diagram or to create
one.
Structure This diagram shows the architecture of the composite classes that define the model
Diagram structure. This diagram is available for the majority of profiles. Click this button to be
able to open an existing structure diagram or to create one.
Open A statechart defines the behaviors of individual classes in the system. This diagram
Statechart is available for the majority of profiles and also the FunctionalC profile. Click this
button to be able to create one a statechart.
Open Activity This diagram shows the lifetime behavior of an object, or the procedure that is
Diagram executed by an operation in terms of a process flow, rather than as a set of reactions
to incoming events. This diagram is available for the majority of profiles. Click this
button to be able to create an activity diagram.
Panel Diagram This diagram provides you with a convenient way to demonstrate a user device.
During animation or Webify, you can use a panel diagram to activate and monitor
your user application. This diagram is available for Rational Rhapsody in C, Rational
Rhapsody in C++, and Rational Rhapsody in Java projects. Click this button to be
able to open an existing panel diagram or to create one.
Build Diagram This diagram shows how the software is to be built. This diagram is primarily
associated with the FunctionalC profile. Click this button to be able to open an
existing build diagram or to create one.
44 User Guide
Creating diagrams
Diagram
Name Description
Button
Call Graph A call graph shows the relationship of function calls as well as the relationship of
data. This diagram is primarily associated with the FunctionalC profile. Click this
button to be able to open an existing call graph or to create one.
File Diagram This diagram shows how files interact with one another (typically how the #include
structure is created). This diagram is primarily associated with the FunctionalC
profile. Click this button to be able to open an existing file diagram or to create one.
Message This diagram shows how the files functionality might interact through messaging
Diagram (synchronous function calls or asynchronous communication). This diagram is
primarily associated with the FunctionalC profile. Click this button to be able to open
an existing message diagram or to create one.
Open Flowchart For a function or class the chart, a flow chart shows the operational flow and code
generation. This diagram is primarily associated with the FunctionalC profile. Click
this button to be able to open an existing flow chart.
Rational Rhapsody 45
Introduction to Rational Rhapsody
46 User Guide
Add new elements
Rational Rhapsody 47
Introduction to Rational Rhapsody
General tab
48 User Guide
The Features window
Note that changes cannot be canceled once they have been applied to the model.
General tab
The General tab of the Features window enables you to define the characteristics of the selected
element. The fields for the General tab vary depending on the characteristics of the selected
element. The most common fields on the General tab are as follows:
Stereotype button .
– To sort the order of the selected stereotypes, click the Change Stereotype
Order button .
Default Package specifies a group for the selected element.
Properties tab
The Properties tab of the Features window displays the properties for the currently selected item
(selected in the browser or in a diagram) or all of the properties for a model (choose File > Project
Properties).
For more information about the Properties tab, see Rational Rhapsody properties.
Rational Rhapsody 49
Introduction to Rational Rhapsody
1. Right-click an element in the browser or a diagram and select Features to open the
Features window for that element.
2. Click the Pin button (horizontal orientation) in the upper right corner of the window.
Note that the button changes to a vertical orientation to indicate that the window for
this element will now remain displayed.
In pinned mode, the features displayed in the pinned window remain displayed and accessible
from all of the window tabs even when a different element is selected. Therefore, you can display
and pin two or three Features windows to compare the information for the elements.
When you no longer need to see the features of the element displayed, you can click the Pin button
again to disconnect it from the element or simply close the window.
To remove these buttons from view, right-click the title bar for the Features window and uncheck
Features Toolbar.
To dock the Features window in the Rational Rhapsody window, do one of the following actions:
Double-click the title bar of the Features window. The window will jump to the location
where it was last docked. To dock the window in a different location, click the title bar
and drag the window to the intended location.
Right-click the title bar and select Enable Docking by Drag to display a check mark and
drag the window to the intended location.
50 User Guide
The Features window
To open more than one Features window, right-click an element and select Features in New
Window.
When opened as a new window, the Features window remains focused on the same element, even
when you change the browser or graphic editor selection. Any changes made to that element from
another view (such as the browser or a diagram editor) are automatically updated in the Features
window. This enables you to keep track of the features for a particular element while working with
other parts of the model.
When you have an open Features window that is focused on a particular element, you can locate
that element in the browser by clicking the Locate button at the bottom of the window.
Alternatively, you can locate the item by selecting the Locate in Browser tool from the standard
toolbar.
2. Choose the relevant menu item in the View menu, for example, View > Description.
Rational Rhapsody 51
Introduction to Rational Rhapsody
To dock a the Features window or a stand-alone window for one of its tabs:
1. Right-click the title bar for the window and select Enable Docking by Drag.
Notice that a check mark displays to the left of the command on the pop-up menu.
2. Drag the window to one of the borders or other docking locations in the Rational
Rhapsody window.
Notice that upon reaching one of these locations, the outline of the window changes to
reflect the area the window occupies when docked.
Note
When one of these windows is docked, it continues to display the information in the same
manner as it does when it is “pinned,” as described in Pinning the Features window.
To undock without disabling the docking capability, drag the window to one of the
non-docking locations in the Rational Rhapsody window.
To disable docking and undock:
a. Right-click the title bar for the window and select Enable Docking by Drag.
Notice that the check mark to the left of the command no longer displays.
52 User Guide
The Features window
Note
This feature is used exclusively for elements with the New Term stereotype.
To hide one or more tabs on the Features window for a particular metaclass:
b. Be sure to select one metaclass in the Applicable To box and select the New Term
check box on the General tab of the Features window for your stereotype.
Rational Rhapsody 53
Introduction to Rational Rhapsody
d. Click the box to the right of the property name and type the names of the tabs,
separated by a comma, that you want to hide; for example,
Description,Relations,Tags.
e. Click OK.
54 User Guide
Hyperlinks
3. Apply the stereotype to a model element of the metaclass. For example, if you selected the
Class metaclass (in the Applicable To box on the General tab of the Features window for
the stereotype), then you can apply this stereotype (select it from the Stereotype
drop-down menu on the General tab of the Features window for the class) to any classes
you currently have in your model or any that you create.
Note: When you define a stereotype as a New Term, it is given its own category in
the Rational Rhapsody browser, and any elements to which this stereotype is
applied are displayed under this category.
If you want to display a previously hidden tab, delete the name of that tab from the list you entered
in the Model::Stereotype::HideTabsInFeaturesDialog property.
Hyperlinks
Rational Rhapsody supports both internal hyperlinks, which point to Rhapsody model elements,
and external hyperlinks, which point to a URL or file.
Use the DiffMerge tool to compare models to locate differences in diagrams and to merge
models that contain hyperlinks.
Note: You can edit a description that uses hyperlinks or RTF format in the DiffMerge
tool if it is from the left or right side of the comparison, but you cannot edit a
description from a merge.
Export hyperlinks using the Rhapsody COM API.
Note: You cannot create or modify hyperlinks using the COM API.
Report on hyperlinks using ReporterPLUS.
Find references to hyperlinks using the Show References feature.
Rational Rhapsody 55
Introduction to Rational Rhapsody
Create hyperlinks
You can create hyperlinks inside the description of an element, or with the Rational Rhapsody
browser.
A typical use for the Description tab of the Features window is to enter a description for whatever
Rhapsody element you currently have open. For example, if you have the Features window open
for a class, you can enter a detailed description for the class on the Description tab. You can do the
same on the Description tab for an attribute, an event, a package, and so on.
Note
Hyperlinks created in the Description are not model elements and can neither be viewed in
the browser nor accessed by the API.
2. On the Description tab, right-click in the open field and select Hyperlink.
Note: If you want to replace pre-existing text with a hyperlink, select the text before
right-clicking.
3. On the Hyperlink window, specify the hyperlink text and target.
The Text to display group specifies the text for the hyperlink. The possible values
are as follows:
– Free text displays the specified text as the hyperlink text.
– Target name displays the full path of the target as the hyperlink text.
– Target label displays the label of the target as the hyperlink text. This option
is available only for internal hyperlinks that have labels.
– Tag value displays the value for the tag. Note that this value is available only
when you select a tag as the hyperlink target. For an example that uses this
field, see Using tag values in hyperlinks.
The Link target group specifies the target file, Web page, or model element. You
can specify the target by typing the target in the text field, using the list to select
the model element in the model, or clicking the Ellipses button to open a new
window so you can navigate to the target file.
Note: You can include a relative path in the hyperlink target. If you use a relative path,
the base directory is the one where the
<Project name>.rpy file is located.
56 User Guide
Hyperlinks
4. Click OK.
The hyperlink is displayed on the Description tab as blue, underlined text. This type of
hyperlink is not displayed in the browser.
1. Right-click the element to which you want to add the hyperlink and select Add New >
Relations > Hyperlink.
Rhapsody creates a hyperlink in the browser.
Note: Add New > Relations is the default menu command structure in Rhapsody. It
can be changed by users. This topic assumes that all defaults are in place.
2. Open the Features window for the new hyperlink.
4. Specify the hyperlink target in the Link target group by typing the path, using the
drop-down list, or using the navigation window.
5. Optionally, specify a stereotype or description.
6. Click OK.
The hyperlink is added to the Hyperlinks category under the owner element.
To improve readability, there are different icons for the different targets, such as the following
targets:
Word files
Classes
URLs
You can drag-and-drop hyperlinks from the Hyperlinks category of one element to that of another.
Similarly, you can copy hyperlinks from the Hyperlinks category of one element to that of
another by dragging-and-dropping and pressing Ctrl, or using the Copy and Paste shortcuts.
Rational Rhapsody 57
Introduction to Rational Rhapsody
Following a hyperlink
To follow a hyperlink, double left-click it. The corresponding file, window, or URL is displayed.
Alternatively, you can use the Open Hyperlink option in the menu.
Edit a hyperlink
You can edit a hyperlink using the Features window or from within the Description area,
depending on the type of hyperlink.
Note
You cannot rename a hyperlink directly from the browser. You must open the Features
window.
Use the Features window to change the features of the hyperlink, including its text display and
target.
Name specifies the name of the element. The default name is hyperlink_n, where n is an
incremental integer starting with 0.
Text to display specifies the text for the hyperlink. The possible values are Free text,
Target name, Target label, and Tag value. For more information on these options, see
Creating hyperlinks on the Description tab.
Link target specifies the target file, Web page, or model element.
Description describes the hyperlink.
2. On the Description tab, right-click the hyperlink in the text and select Edit Hyperlink.
3. In the Hyperlink window (see Creating hyperlinks on the Description tab), edit the link.
4. Click OK.
58 User Guide
Hyperlinks
1. Wherever you want to create the hyperlink, right-click and select Features to open the
Features window.
2. On the Tags tab, use the Quick Add group to enter the name of the hyperlink and its
value. If the tag does not have a value, the value «empty» is displayed.
3. Click OK.
1. Click the tag value hyperlink or click the New button on the Tags tab to open this
Features window.
3. Click OK.
Deleting a hyperlink
Delete a hyperlink using one of the following methods:
In the text area of the Description tab, right-click the link and select Remove Hyperlink,
or use the backspace key or Delete icon.
In the browser, select the hyperlink and select Delete from Model or click the Delete icon.
Hyperlink limitations
Note the following limitations:
You can select tags as hyperlink targets, which are available in the Rhapsody browser. For
example, if you have the tag color in a profile that is applicable to all classes, you cannot
see the tag color under a given class instance in the browser. The Rhapsody browser
shows only local or overridden tags; however, these tags are shown in the Tags tab of the
Features window for the class.
If you override a tag value in a package, the tag is considered to be local because it is tied
to that specific element. If you have a hyperlink to the local tag and subsequently delete
the tag, the reference will be unresolved.
Rational Rhapsody 59
Introduction to Rational Rhapsody
Create a diagram
This topic is for Eclipse users.
Besides being able to import a Rational Rhapsody project and all its diagrams, you can create
diagrams in the Rational Rhapsody Platform Integration.
Creating a diagram
This procedure is for Eclipse users.
1. On the New Diagram window, select a diagram type from the drop-down list.
3. If available, select a location for the diagram from the drop-down list.
4. If available, if you want to populate the new diagram automatically with existing model
elements. Click the Populate Diagram check box.
5. Click Finish.
1. On the New Rhapsody Project window, enter a name for your Rational Rhapsody project.
3. Select the language for your project from the drop-down list.
4. If available, select the Rational Rhapsody project type from the drop-down list.
5. If you want to designate a location for your project other than your default location, clear
the Use default location check box and browse to your preferred location.
60 User Guide
Import a Rational Rhapsody project
6. Click Finish.
7. If the directory for your project is not already created, click Yes when you are asked if you
want to create it.
To import a project:
With All Subunits. Select this radio button to load all units in the project,
ignoring workspace information. For information on workspaces, see Using
workspaces.
Without Subunits. Select this radio button to prevent loading any project units.
All project units will be loaded as stubs.
Restore Last Session. Select this radio button if you would like to load only those
units that were open during your last Rational Rhapsody session.
4. Click Finish.
Rational Rhapsody 61
Introduction to Rational Rhapsody
2. On the message box that displays click Continue to open the Reverse Engineering
window.
3. See Reverse engineering legacy code.
Search window
This topic is for Eclipse users.
The Search window shows results from searches of your model. Note that this window might not
appear until you perform a search (for example, choose Search > Search and select the Rhapsody
tab). For more information about doing searches in Rational Rhapsody, see Searching models.
Graphic editors
This topic is for Eclipse users.
You can use the graphic editors to analyze, design, and construct the system using UML diagrams.
Diagrams enable you to observe the model from several different perspectives, like turning a cube
in your hand to view its different sides. Depending on its focus, a diagram might show only a
subset of the total number of classes, objects, relationships, or behaviors in the model. Together,
the diagrams represent a complete design.
Rational Rhapsody adds the objects created in diagrams to the Rational Rhapsody project, if they
do not already exist. Conversely, Rational Rhapsody removes elements from the project when they
are deleted from a diagram. However, you can also add existing elements to diagrams that do not
need to be added to the project, and remove elements from a diagram without deleting them from
the model repository.
For more information about the graphic editors, see Graphic editors.
62 User Guide
Call stack and event queue
The call stack view describes the current stack of calls for the focus thread. The event queue view
describes the current state of the event queue for the focus thread.
Rational Rhapsody 63
Introduction to Rational Rhapsody
64 User Guide
Classes and types
Classes provide a specification (blueprint) for objects, which are self-contained, uniquely
identified, run-time entities that consist of both data and operations that manipulate this data.
Classes can contain attributes, operations, events, relations, components, super classes, types,
actors, use cases, diagrams, and other classes. The Rational Rhapsody browser icon for a class is a
three-compartment box with the top, or name, compartment filled in. For an example of this icon,
see Defining the attributes of a class.
Creating a class
To create a class, in the Rational Rhapsody browser:
Right-click the Classes category to which you want to add a class and select Add New
Class.
Right-click a package and select Add New > Class.
Select a package and choose Edit > Add New > Class.
Rational Rhapsody creates a new class and names it class_n, where n is greater than or equal to 0.
The new class is located in the browser under the Classes category, and is selected so that you can
rename it.
Class features
Use the Features window to define and modify a class. You can also use it to re-arrange the order
of attributes and operations, control the display of attributes and operations, create templates, and
so on. To open the Features window for a class, double-click it on the Rational Rhapsody browser,
or right-click it and select Features.
Rational Rhapsody 65
Classes and types
On the General tab, you define the general features for a class through the various controls on the
tab.
In the Name box you specify the name of the element. The default name is class_n,
where n is an incremental integer starting with 0. To enter a detailed description of the
class, use the Description tab.
You use the L button to open the Name and Label window to specify the label for the
element, if any. For information on creating labels, see Descriptive labels for elements.
In the Stereotype list you select the stereotype of the element, if any. For information on
creating stereotypes, see Stereotypes.
– To select from a list of current stereotypes in the project, click the Select
Stereotype button .
– To sort the order of the selected stereotypes, click the Change Stereotype
Order button .
Note: The COM stereotypes are constructive; that is, they affect code generation.
In the Main Diagram list you specify the diagram (from the ones available) that contains
the most complete view of the class.
In the Concurrency drop-down list box you specify the concurrency. The possible values
are as follows:
– Active means the class runs on its own thread.
– Sequential means the class runs on the system thread.
In the Defined In drop-down list box you specify the owner for the class. Every class lives
inside either a package or another class.
Note: A class not explicitly drawn in a package belongs to the default package of the
diagram. If the diagram is not explicitly assigned to a package, the diagram
belongs to the default package of the project.
In the Class Type area you specify the class type. The possible values are as follows:
– Regular creates a class.
– Template creates a template. To specify the necessary arguments, use the
Template Parameters tab that displays once you select the Template radio
button. For more information, see Creating a template class.
– Instantiation creates an instantiation of a template. To specify the necessary
arguments, use the Template Instantiation tab that displays once you select
the Instantiation radio button. For more information, see Instantiating a
template class.
66 User Guide
Class features
Note: To create an instance of a class, select the Instantiation radio button and select
the template that the instance is from. For example, if you have a template class
A and create B as an instance of that class, this means that B is created as an
instance of class A at run time.
In this syntax, ns can be either a package or a class. Primary model elements are packages, classes,
types, and diagrams. Classes can contain only other classes, stereotyped classes (such as actors),
and types.
You can select a nested element in a window by entering its name in either of the following
formats:
<name> in <ns1>::<ns2>::...<nsn>
<ns1>::<ns2>::...<nsn>::<name>
The Rational Rhapsody browser icon for attributes is a three-compartment class box with the
middle compartment filled in:
Rational Rhapsody 67
Classes and types
The Attributes tab of the Features window contains a list of the attributes that belong to the class.
It allows you to perform the following tasks:
To create a new attribute, either click the <New> row in the list of attributes, or click the
New button in the upper, right corner of the window. The new row is filled in with
the default values.
Modify an existing attribute.
– Select the attribute and click the open Feature Dialog button to open the
Features window for the attribute and make your changes there. You can also
double-click the attribute name or icon next to the name to open the Features
window.
Delete an attribute.
To delete an attribute from the model, select the attribute and click the Delete button .
View the attribute values.
To view the values for an attribute, open the Features window for it.
You can use the following keyboard shortcuts within an editable list:
68 User Guide
Class features
When you click the Invoke Features window button or double-click an attribute, the Attribute
window opens. This window is also displayed when you select an attribute in the browser and
might have different options than shown in here.
On the General tab, you define the general features for a attribute through the various controls on
the tab.
In the Name box you specify the name of the attribute. The default name is attribute_n,
where n is an incremental integer starting with 0. To enter a detailed description of the
attribute, use the Description tab.
You use the L button to open the Name and Label window to specify the label for the
element, if any. For information on creating tables, see Descriptive labels for elements.
In the Stereotype list you specify the stereotype of the attribute, if any. For information on
creating stereotypes, see Stereotypes for information on creating stereotypes.
– To select from a list of current stereotypes in the project, click the Select
Stereotype button .
– To sort the order of the selected stereotypes, click the Change Stereotype
Order button .
Note: The COM stereotypes are constructive; that is, they affect code generation.
In the Attribute type area you specify the attribute type. There are two ways to specify the
type:
– Select the Use existing type check box to select a predefined or user-defined
type or class. Use the Type list to select from among the Rational Rhapsody
predefined types, and any types and classes you have created in this project.
Or to define a new type, delete the value in the Type drop-down list box to
enable the Invoke Features window button and click it to open the Type
window.
When you generate code, each attribute is generated into three entities:
– The data member itself
– An accessor (get) method for retrieving the data value
– A mutator (set) method for setting the data value
Rational Rhapsody 69
Classes and types
Note: The visibility setting affects only the visibility of the accessor and mutator
methods, not of the data member itself. The data member is always protected,
regardless of the access setting.
In the Multiplicity box (displayed when appropriate) you specify the multiplicity of the
attribute. If this is greater than 1, use the Ordered check box to specify whether the order
of the reference type items is significant. The modifier choices are as follows:
– Constant specifies whether the attribute is read-only (check box is selected)
or modifiable (check box is cleared).
– Reference specifies whether the attribute is referenced as a reference, such as
a pointer (*) or an address (&) in C++.
– Static creates a static attribute, which belongs to the class as a whole rather
than to individual objects. See Initializing static attributes.
In the Initial Value box you specify the initial value for the attribute.
3. Type a declaration for the new type in the C++[Java] Declaration box using the proper
syntax. Note the following information:
You can omit the semicolon at the end of the line; Rational Rhapsody
automatically adds one if it is not present.
Substitute %s for the name of the type in the declaration. For example:
typedef unsigned char %s[100]
This translates to the following declaration in the generated code:
typedef unsigned char msg_t[100];
4. Add a description for the type on the Description tab.
5. Click OK.
Rational Rhapsody adds it to the Types category under the package to which the class belongs,
rather than under the class itself.
70 User Guide
Class features
For information on code generation for static attributes, see Generating Code for Static Attributes.
Class operations
The Operations tab of Features window for a class enables you to add, edit, or remove operations
from the model or from the current OMD view. It contains a list of all the operations belonging to
the class.
Rational Rhapsody enables you to create sets of standard operations for classes and events. For
more information, see Using Standard Operations.
Primitive operations
Receptions
Triggered operations
Constructors
Destructors
Rational Rhapsody 71
Classes and types
Primitive operations
A primitive operation is one whose body you define yourself instead of letting Rational Rhapsody
generate it for you from a statechart.
1. On the Rational Rhapsody browser, double-click a class to open its Features window.
2. On the Operations tab, either click the <New> row in the list of operations or click the
New button in the upper, right corner of the window and select PrimitiveOperation. The
new row is filled in with the default values.
3. By default, Rational Rhapsody names the new primitive operation Message_n, where n is
greater than or equal to 0. Type the new name for the operation in the Name column.
5. Click OK.
Alternatively, you can create a primitive operation through the use of the Rational Rhapsody
browser, as follows:
1. In the Rational Rhapsody browser, right-click the class, actor, operation, or use case node
to which you want to add the operation and select Add New > Operation. Alternatively,
you can select the item and choose Edit > Add New > Operation from the menu bar.
In the Name box you specify the name of the element. The default name is Message_n,
where n is an incremental integer starting with 0. To enter a detailed description of the
operation, use the Description tab.
You use the L button to open the Name and Label window to specify the label for the
element, if any. For information on creating labels, see Descriptive labels for elements for
information on creating labels.
72 User Guide
Class features
In the Stereotype list you specify the stereotype of the attribute, if any. For information on
creating stereotypes, see Stereotypes.
– To select from a list of current stereotypes in the project, click the Select
Stereotype button .
– To sort the order of the selected stereotypes, click the Change Stereotype
Order button .
Note: The COM stereotypes are constructive; that is, they affect code generation.
In the Visibility list you specify the visibility of the primitive operation: Public,
Protected, or Private.
In the Type drop-down list box you specify the operation type. For primitive operations,
this box is set to Primitive Operation. If this is a template class, select the Template
check box. To specify the necessary arguments for the template, use the Template
Parameters tab that displays once you select the Template check box. For more
information, see Creating a template class.
In the Returns area you specify the return type of a function.
– If the function will return a defined type, select the Use existing type check
box and select the return type from the Type drop-down list box that displays
once you select the check box. Or to define a new type, delete the value in the
Type drop-down list box to enable the Invoke Features window button and
click it to open the Type window.
Receptions
A reception specifies the ability of a class to react to a certain event (called a signal in the UML).
The name of the reception is the same as the name of the event; therefore, you cannot change the
name of a reception directly. Receptions are displayed under the Operations category for the
class.
Rational Rhapsody 73
Classes and types
1. On the Rational Rhapsody browser, double-click a class to open its Features window.
2. On the Operations tab, either click the <New> row in the list of operations or click the
New button in the upper, right corner of the window and select Reception from the
pop-up menu. The new row is filled in with the default values.
3. Type the name of the reception in the Event box on the New Reception window. If
Rational Rhapsody cannot find an event with the given name, a confirmation box opens,
prompting you to create a new event. Click Yes to create a new event and the specified
reception.
4. Open the Features window for the new reception operation you just created and set its
other values as necessary.
5. Click OK.
1. In the browser, right-click a class, actor, operation, or use case node and select Add New >
Reception. The New Reception window opens.
If Rational Rhapsody finds an event with the specified name, it creates the new
reception and displays it in the browser.
If Rational Rhapsody cannot find an event with the given name, a confirmation
box opens, prompting you to create a new event. Click Yes to create a new event
and the specified reception.
Note the following information:
When you add a new reception with a new name to a class, an event of that name is added
to the package. If you specify an existing event name, the reception simply points to that
event.
Receptions are inherited. Therefore, if you give a trigger to a transition with a reception
name that does not exist in the class but does exist in its base class, Rational Rhapsody
does not create a new reception.
74 User Guide
Class features
Reception features
The Features window for a reception enables you to change the features of a reception, including
its type and the event to which the reception reacts. On the General tab, you define the general
features for a reception through the various controls on the tab. Notice that the signature for the
reception is displayed at the top of the General tab of the Features window.
In the Name box you specify the name of the reception. The default name is event_n,
where n is an incremental integer starting with 0. To enter a detailed description of the
reception, use the Description tab.
If the Name box is inaccessible, click the L button to open the Name and Label window to
change the name, if any. For information on creating labels, see Descriptive labels for
elements.
In the Stereotype list you specify the stereotype of the attribute, if any. For information on
creating stereotypes, see Stereotypes.
– To select from a list of current stereotypes in the project, click the Select
Stereotype button .
– To sort the order of the selected stereotypes, click the Change Stereotype
Order button .
Note: The COM stereotypes are constructive; that is, they affect code generation.
In the Visibility list you specify the visibility of the reception (Public, Protected, or
Private), if available.
In the Type drop-down list box you specify the operation type. For receptions, this box is
set to Reception.
In the Event list you specify the event to which the reception reacts. To view or modify the
features of the event itself, click the Invoke Features window button.
Deleting receptions
You cannot delete receptions in the following cases:
Triggered operations
A triggered operation can trigger a state transition in a statechart, just like an event. The body of
the triggered operation is executed as a result of the transition being taken. For more information,
see Triggered operations.
Rational Rhapsody 75
Classes and types
Constructors
Constructors are called when a class is instantiated, generally to initialize data members with
values relevant to that object.
Creating a constructor
To create a constructor:
1. Depending on if you want to use the Features window or the Rational Rhapsody browser:
4. Type in a name for the new constructor and change the default values as necessary.
5. Click OK twice.
76 User Guide
Class features
The new constructor is listed under the Operations category for the class in the Rational
Rhapsody browser.
.
On this General tab, you define the general features for a constructor through the various controls
on the tab. Notice that the signature for the constructor is displayed at the top of the General tab of
the Features window.
In the Name box you specify the name of the constructor. The default name is the name of
the class it creates. To enter a detailed description of the constructor, use the Description
tab.
If the Name box is inaccessible, click the L button to open the Name and Label window to
change the name, if any. For information on creating labels, see Descriptive labels for
elements.
In the Stereotype list you specify the stereotype of the attribute, if any. For information on
creating stereotypes, see Stereotypes.
– To select from a list of current stereotypes in the project, click the Select
Stereotype button .
– To sort the order of the selected stereotypes, click the Change Stereotype
Order button .
Note: The COM stereotypes are constructive; that is, they affect code generation.
In the Visibility list you specify the visibility of the reception (Public, Protected, or
Private), if available. The default value is Public.
Rational Rhapsody 77
Classes and types
In the Initializer box you enter code if you want to initialize class attributes or super
classes in the constructor initializer. To access the text editor, click the Ellipses button .
For example, to initialize a class attribute called a to 5, type the following code:
a(5)
Note: In C++, this assignment is generated into the following code in the class
implementation file to initialize the data member in the constructor initializer
rather than in the constructor body:
//-------------------------------------------------------
// A.cpp
//-------------------------------------------------------
A::A() : a(5) {
//#[operation A()
//#]
};
Note: You must initialize const data members in the constructor initializer rather than
in the constructor body.
78 User Guide
Class features
Destructors
A destructor is called when an object is destroyed, for example, to de-allocate memory that was
dynamically allocated for an attribute during construction.
Creating a destructor
To create a destructor, follow the instructions for Creating a primitive operation, but for the type,
select Destructor.
On this General tab, you define the general features for a destructor through the various controls
on the tab.
In the Name box you specify the name of the destructor. By definition, destructors have
the same name as the class, preceded by a tilde (~) symbol. To enter a detailed description
of the reception, use the Description tab.
If the Name box is inaccessible, click the L button to open the Name and Label window to
change the name, if any. For information on creating labels, see Descriptive labels for
elements.
In the Stereotype list you specify the stereotype of the attribute, if any. For information on
creating stereotypes, see Stereotypes.
– To select from a list of current stereotypes in the project, click the Select
Stereotype button .
– To sort the order of the selected stereotypes, click the Change Stereotype
Order button .
Note: The COM stereotypes are constructive; that is, they affect code generation.
In the Visibility list you specify the visibility of the reception (Public, Protected, or
Private). By default, destructors are Public.
Rational Rhapsody 79
Classes and types
In the Modifiers area you specify the modifiers of the destructor. Select Virtual, if
wanted.
To type code for the body of the destructor, use the Implementation tab.
Define relations
The term “relations” refers to all the relationships you can define between elements in the model
(not just classes); for example, associations, dependencies, generalization, flows, and links. (In
previous versions of Rational Rhapsody, the term referred to all the different kinds of
associations.)
The Relations tab lists all the relationships (dependencies, associations, and so on) the class is
engaged with.
80 User Guide
Class features
Type specifies the relation type (for example, Association End and Dependency).
Direction specifies the direction of the relationship (From or To).
From/To specifies the target of the relationship. For example the dependency
Dishwasher.AbstractFactory goes from the Dishwasher class to the
AbstractFactory.
Data specifies any additional data used by the relationship.
For example, if you have a port that provides the interface MyInterface, the Data column
would list Provided Interface.
Rational Rhapsody 81
Classes and types
Note that you can show the relations for a class, an object, and a package. You would use the same
procedure as noted below, except that you would select that particular element (for example, an
object) instead.
1. Right-click a class in the Rational Rhapsody browser and select Show Relations in New
Diagram.
Rational Rhapsody created an object model diagram that shows all the relations
for the selected class.
Rational Rhapsody also named the new object model diagram from the name of
the class you selected and it created an Object Model Diagram category to hold
the new diagram within the package where the class resides.
82 User Guide
Class features
The Show Relations in New Diagram pop-up menu command is available for classes,
objects, and packages from the Rational Rhapsody browser as well as on a diagram. For
both the browser and on a diagram, you would right-click the element (for example, an
object) and select Show Relations in New Diagram.
Note: For a diagram you can select multiple elements (for example, two classes). Use
Ctrl+Click to make multiple selections and then right-click one of the selected
elements to open the pop-up menu and click Show Relations in New
Diagram.
The location of the new object model diagram created by Show Relations in New
Diagram depends on whether you started the command from the browser or a diagram:
– When started from the browser, Show Relations in New Diagram creates the
diagram in the same location as the selected element and places it in an
Object Model Diagram category (which Rational Rhapsody creates if the
category is not already available).
– When started from a diagram, Show Relations in New Diagram creates the
object model diagram in the same location in which the source diagram
resides.
The new object model diagram created by Show Relations in New Diagram will be
named the same name as the class, object, or package from which it was created. If there
is already an object model diagram with that name, a number will be appended to the
name (for example, Dishwasher_9).
See also Automatically populating a diagram.
Rational Rhapsody 83
Classes and types
The <<derive>> stereotype specifies a derivation relationship among model elements that are
usually, but not necessarily, of the same type. A derived dependency specifies that:
1. Right-click the class for which you are creating a derivation and select Add New >
Relations > Derivation.
2. In the window, select from the Depends on drop-down menu. The items in the drop-down
menu are as follows:
84 User Guide
Making a class an instance
If the class represents an instance, select the This box is also an instance check box. This is
equivalent to giving the class an instance name in the OMD. If this box is checked, the following
boxes become active:
The multiplicity indicates the number of instances that can participate at either end of a
relation. Multiplicity can be shown in terms of a fixed number, a range, or an asterisk (*),
meaning any number of instances including zero.
2. If a directory for the configuration that the class belongs to has not yet been created,
Rational Rhapsody asks if you want to create the directory. The configuration directory is
under the component directory. Click Yes.
3. Rational Rhapsody creates the configuration directory and generates the class code to it.
An output window opens at the bottom of the Rational Rhapsody window for the display
of code generation messages.
Rational Rhapsody 85
Classes and types
To set Rational Rhapsody to open the editor associated with the file extension instead of the
internal code editor:
3. Click OK.
For example, the following Initialize() operation for the Connection class in the PBX sample
contains user code that was entered in the Implementation field of the Operation window. The user
code is placed between the annotation symbols when code is generated for the class:
void Connection::Initialize() {
//#[ operation Initialize()
DigitsDialed = 0;
Digits[0] = 0;
Digits[1] = 0;
Busy = FALSE;
Extension = 0;
//#]
}
86 User Guide
Opening the main diagram for a class
You can edit the code between the annotation symbols in a text editor and then roundtrip your
changes back into the model. The roundtripped edits will be retained upon the next code
generation. This is how Rational Rhapsody keeps the code and the model in sync to provide
model-code associativity.
Note
Any text edits made outside the annotation symbols might be lost with the next code
generation. For more information, see Deleting Redundant Code Files.
To roundtrip code changes back into the model:
1. Edit the generated class code between the //#[ and //#] annotation symbols.
2. In the browser or diagram, right-click the class containing the code that you just edited and
select Roundtrip.
If you view the Implementation box of the specification window for the operation (or the statechart
for the class if you edited transition code), you can see that your text edits were added to the
model.
Rational Rhapsody 87
Classes and types
Display name specifies how the class name is displayed. A class is always inside at least
one package, but the package can be nested inside other packages, and the class can also
be nested inside one or more classes. The class name displayed in the OMD can show
multiple levels of nesting in the class name.
88 User Guide
Display option settings
Advanced opens the Advanced Image View Options window. See Advanced Image View
Options window
Ports specifies whether to show new ports and their interfaces.
Rational Rhapsody allows you to specify which ports to display in the diagram using the
Show New Ports functionality. For more information, see Ports.
2. Click the Display button to move the element to the Shown in Diagram list.
3. Repeat for each element or simply click the All button to select all of the elements in the
list and display them.
4. You can move elements up and down in the Shown In Diagram list or remove them using
the other three buttons in this window.
5. Click OK.
Similarly, the Operations tab allows you to select which, if any, operations to display in the
diagram.
Rational Rhapsody 89
Classes and types
To remove a class from the diagram, right-click the class and select Remove from View.
To delete the class entirely from the model, do one the following actions:
Note
When you delete a class, all of its objects are also deleted.
Ports
A port is a distinct interaction point between a class and its environment or between (the behavior
of) a class and its internal parts. A port allows you to specify classes that are independent of the
environment in which they are embedded. The internal parts of the class can be completely
isolated from the environment and vice versa.
Required interfaces characterizes the requests that can be made from the class for a port
(via the port) to its environment (external objects). A required interface is denoted by a
socket notation.
Provided interfaces characterizes the requests that could be made from the environment
to the class via the port. A provided interface is denoted by a lollipop notation.
These interfaces are specified using a contract, which by itself is a provided interface. For more
information, see The Port Contract tab.
If a port is behavioral, the messages of the provided interface are forwarded to the owner class; if
it is non-behavioral, the messages are sent to one of the internal parts of the class. Classes can
distinguish between events of the same type if they are received from different ports.
Note
See the HomeAlarmwithPorts sample model (under <Rational Rhapsody installation
path>\Samples\CppSamples) for an example of a model that uses ports.
90 User Guide
Ports
Considerations
Ports are interaction points through which objects can send or receive messages (primitive
operations, triggered operations, and events). Ports in UML have a type, which in Rational
Rhapsody is called a contract. A contract of a port is like a class for an object.
If a port has a contract (for example, interface I), the port provides I by definition. If you want the
port to provide an additional interface (for example, interface J), then, according to UML, I must
inherit J (because a port can have only one type). In the case of Rational Rhapsody, this
inheritance is created automatically once you add J to the list of provided interfaces (again, this is
a port with an explicit contract I). According to the UML standard, if I and J are unrelated, you
must specify a new interface to be the contract and have this interface inherit both I and J.
Working with implicit contracts has pros and cons. If the port is connected to other ports that
provide and require only subsets of its provided and required interfaces, it is more natural to work
with implicit contracts. However, if the port is connected to another port that is exactly “reversed”
(see the check box in the Features window for the port) or if other ports provide and require the
same set of interfaces, it makes sense to work with explicit contracts. This is similar to specifying
objects separately from the classes, or objects with implicit classes in the case when only a single
object of this type or class exists in the system.
Rapid ports
Rapid ports are ports that have no provided and required interfaces (which means that the contract
is implicit, because a port with an explicit contract, by definition, provides a contract interface).
These ports relay any events that come through them. The notion of rapid ports is Rational
Rhapsody-specific, and enables users to do rapid prototyping using ports. This functionality is
especially beneficial to users who specify behavior using statecharts, without the need to elaborate
the contract at the early stages of the analysis or design.
Rational Rhapsody 91
Classes and types
Creating a port
To create a port in an object model diagram:
2. Click the class boundary to place the port. A text box opens so you can name the new port.
3. Type the name for the port, then press Enter to dismiss the box. Note that the port label
uses the convention portName{[multiplicity]}. For example:
a. p
b. p[5]
c. p[*]
The new port displays as a small square on the boundary of its class.
Use the Ports tab of the Features window for the class. For more information, see Define
class ports.
Right-click the class in the browser and then select Add New > Port.
92 User Guide
Specifying the features of a port
In the Name box you specify the name of the port. The default name is port_n, where n is
an incremental integer starting with 0. To enter a detailed description of the attribute, use
the Description tab.
You use the L button to open the Name and Label window to specify the label for the
element, if any. For information on creating labels, see Descriptive labels for elements.
In the Stereotype list you specify the stereotype of the port. For information on creating
stereotypes, see Stereotypes.
– To select from a list of current stereotypes in the project, click the Select
Stereotype button .
– To sort the order of the selected stereotypes, click the Change Stereotype
Order button .
Note: The COM stereotypes are constructive; that is, they affect code generation.
In the Contract drop-down list box you specify the port contact. The list contains the
following possible values:
– <Implicit> means the contract is implicit.
– <New> enables you to define a new contract. If you select this value, Rational
Rhapsody displays a separate class Features window so you can define the
new interface.
– A list of classes with a stereotype that includes the word “interface.”
The arrow button next to the Contract box opens the Features window for the
contract. However, this button is disabled if the contract is implicit.
In the Multiplicity drop-down list box you specify the multiplicity of the port. The
multiplicity is included in the port label if it is greater than 1.
In the Visibility drop-down list box you specify the visibility for the port (Public,
Protected, or Private). The default value is Public.
Rational Rhapsody 93
Classes and types
Explicit means the contract is an explicit interface in the model. An explicit contract can
be reused so several ports can have the same contract.
Implicit means the contract is a “hidden” interface that exists only as the contract of the
port.
For both provided and required interfaces, three buttons are available:
Add to add a new interface to the list of available interfaces. For provided interfaces, this
means that the contract inherits the selected interface; for required interfaces, this means
that the contract has a new dependency stereotyped «Usage» towards the interface.
Edit to open the Features window for the selected element so you can modify it.
Remove to remove the relation with the contract for the selected interface.
Note that if you selected the Reversed check box on the General tab, the bottom of the Contract
tab displays a message in red stating that the contract is reversed.
1. To specify the provided interfaces, select the Provided folder icon, then click the Add
button in the top group box. The Add new interface window opens.
2. Either type in the new name of the interface, or use the list to specify the interface.
3. Click OK.
4. You return to the Contract tab, which now lists the provided interface you just specified.
5. To specify the required interface, click the Required folder, then select Add. The Add
New Interface window opens.
94 User Guide
Specifying the features of a port
1. In the diagram, right-click the class or object that owns the port and select Display
Options.
2. Clear the Show Ports Interfaces or Show New Ports check box, as intended.
3. Click OK.
You can specify how the port name and stereotype are displayed using the Display Options
window for the port itself.
For more information on displaying ports, see Selecting which ports to display in the diagram.
Rational Rhapsody 95
Classes and types
The following table shows the properties (under the ObjectModelGe subject) that control how
ports are displayed.
Note that you cannot selectively show ports in diagrams, either all the ports are displayed, or none
of them are.
96 User Guide
Viewing ports in the browser
Connecting ports
To exchange messages using ports, you must specify links between their objects. You can use one
of these methods:
However, you cannot specify associations via ports nor specify a link between classes, even if the
ends are connected to ports.
Rational Rhapsody 97
Classes and types
In component-based design. For example, when you have a class to be reused in different
systems and has a behavior of its own (not that of one of its parts) that provides and
requires the interfaces of the contract for the port.
The class has a statechart in which the triggers of the transitions are based on the ports
through which the events were received. In other words, because the statechart is able to
distinguish between the ports through which an event was sent, it could react differently
to the same events based on which port the event came from.
Note
Once you specify the contract on a port, you must specify the contract on all the ports that
are connected to it. Otherwise, the code generator will issue a warning that there is a
mismatch in the contracts and the links will not be created.
Rational Rhapsody uses the values of the following framework properties to implement the rapid
ports:
98 User Guide
Using rapid ports
The following figure shows the statechart for the Ping class.
The following figure shows the statechart for the PongMachine part.
During animation, the two objects exchange evPing and evPong events.
Rational Rhapsody 99
Classes and types
If you set Show New Ports mode to on, each new port that is added to the class is also displayed in
the diagram class. Ports created before this graphic class, or while the Show New Ports feature is
off, are not synthesized in the diagram, unless they were created using the graphic editor New Port
option.
If Show New Ports mode is off, any ports created after disabling this mode will not be displayed.
Deleting a port
To remove a specific port from a class, use the Delete from Model or Remove from View option
in the menu for the owning class.
Intermediate-level tasks
Advanced-level tasks
Note
The following example is not complete; it is simply a reference for the subsequent table of
API calls.
Consider the following example:
The following table shows the calls to use to perform the specified tasks.
Task Call
Call an operation. OUT_PORT(src)->f();
Send an event from a to b using the ports. OUT_PORT(src)->GEN(evt);
Listen for an event from port src to port evt[IS_PORT(mon)]/
mon. doYourStuff();
You could also use the OPORT macro, which is equivalent to OUT_PORT.
Task Call
Call an operation. OUT_PORT_AT(src, 5)->f();
Send an event from a to b using the ports. OUT_PORT_AT(src, 5)->GEN(evt);
Listen for an event from port src to port evt[IS_PORT_AT(mon, 5)]/
mon. doYourStuff();
You could also use the OPORT_AT macro, which is equivalent to OUT_PORT_AT.
Intermediate-level tasks
This section describes the intermediate-level APIs used when programming with ports. You use
these APIs whenever the code generator cannot create the links on its own, including the following
cases:
An external source file is used to initialize the system and you must write the code to
create the links between the objects.
The port multiplicities are not definite (for example, *).
The port multiplicities do not match across the links. This could happen when ranges of
multiplicities are used (for example, 1..10).
2. Copy the .cpp file for the new package to the correct class.
Advanced-level tasks
This section describes the advanced-level APIs used when programming with ports. You use these
APIs when the code generator cannot determine how to instantiate the ports. This situation occurs
when the port multiplicity is *.
For example, to instantiate 10 of the src ports, use the following call:
for (int i=0; i<10; ++1) {
// instantiate and add to the container of the owner
newSrc();
}
Behavioral ports are connected to their owning instance using the method connect[ClassName].
For example, to connect behavioral port p to its owner object a (of type A), use the following call:
a.getP()->connectA(a);
If the ports in previous API illustration are behavioral, you would use the following code:
for (int i=0; i<10; ++i) {
newSrc();
//hooks the class so it takes care of the messages
getSrcAt(i)->connectA(this);
}
For more efficiency, use the following code:
for (int i=0; i<10; ++i) {
newSrc()->connectA(this);
Examples:
RiCGEN_PORT (me->myPort, myEvent())
Examples:
RiCIS_PORT(me->myPort)
This returns True if the event currently being handled by the Rational
Rhapsody Developer for C Reactive (instantiated as me) was sent via the port
myPort.
Calling an operation:
– for port called MyPort and operation called myop:
getMyPort().myop();
– for port called MyPort, operation called myop, and multiplicity greater than 1:
getMyPortAt(port index).myop(), for example,
getMyPortAt(2).myop();
Generating and sending an event via a port:
– for port called MyPort and event called evt:
getMyPort().gen(new evt());
– for port called MyPort, event called e2, and multiplicity greater than 1:
getMyPortAt(port index).gen(new e2()), for example,
getMyPortAt(2).gen(new e2());
Detecting the input port through which an event has been sent:
– for port called MyPort:
isPort(getMyPort())
– for port called MyPort, and multiplicity greater than 1: isPort(getMyPort(port
index)), for example,
isPort(getMyPort(3))
Composite types
Rational Rhapsody enables you to create composite types that are modeled using structural
features instead of verbatim, language-specific text. In addition, Rational Rhapsody includes
classes wherever types are used to increase the maintainability of models: if you change the name
of a class, the change is propagated automatically throughout all of the references to it.
1. Right-click a package or the Types category, then select Add New > Type.
5. Specify the kind of data type using the Kind list. The possible values are as follows:
a. Enumeration specifies the new type is an enumerated type. Specify the enumerated
values on the Literals tab. For more information, see Creating enumerated types.
b. Language specifies the new type is a language-specific construct. This is the default
value. For more information, see Creating language types.
c. Structure specifies the new type is a structure, which is a data record. For more
information, see Creating structures.
d. Typedef specifies the new type is a typedef. For more information, see Creating
Typedefs.
e. Union specifies the new type is a union, which is an overlay definition of a data
record. For more information, see Creating unions.
The following table shows the mapping of composite types to the different languages.
1. The generated struct is a simple C-style struct that contains only public data members.
1. On the Literals tab, select the <New> line, and then type the name for the enumerated
value.
3. Click OK.
1. On the Declaration tab, type the declaration statement in the Declaration text box. Use
the expression %s as a placeholder for the type name in the declaration.
2. Click OK.
Using %s
The Rational Rhapsody code generator substitutes %s in type declarations with the type name. This
automates the update of declarations when you rename a type.
To escape the %s characters, type a backslash (\) character before the %s. For example:
#define PRINT printf("\%s\n", myString())
Creating structures
If you selected Structure as the Kind, continue the creation process as follows:
1. On the Attributes tab, select the <New> line, and then type the name for the member.
2. Use the Type list to select the type of the member. Note that the type can be another
composite type.
4. Click OK.
Note
Bit fields (for example, int a :1) are not supported. You can model them using language
types. For more information, see Creating language types.
Creating Typedefs
If you selected Typedef as the Kind, continue the creation process as follows:
1. On the Details tab, specify the typedef in the Basic Type box, or use the list to select the
type. Note that the Basic Type cannot be an implicit type.
Note: If you select a type defined within the model, the arrow button next to the Basic
Type box is available. Click the arrow button to open the Features window for
that class.
2. Specify the multiplicity in the Multiplicity box. The default value is 1.
Note: If the multiplicity is a value higher than 1, the Ordered check box is available.
Click this check box if the order of the reference type items is significant.
3. If the typedef is defined as a constant (is read-only, such as the const qualifier in C++),
enable the Constant check box; if the typedef is modifiable, leave the check box
disabled (empty).
4. If the typedef is referenced as a reference (such as a pointer (*) or a C++ reference (&),
enable the Reference check box.
5. Click OK.
Creating unions
If you selected Union as the Kind, continue the creation process as follows:
1. On the Attributes tab, select the <New> line, then type the name for the member.
2. Use the Type list to select the type of the member. Note that the type can be another
composite type.
3. Click OK.
Note
Ada variant record keys and conditions are not supported.
Properties
The following table lists the properties that support composite types.
Language-independent types
Rational Rhapsody enables you to build static models using language-independent, predefined
types, with no dependency on the implementation language.
The types are defined in the following files (under <Rational Rhapsody installation
path>\Share\<lang>\oxf):
When you create attributes or operations, these language-independent types are included in the
Types list.
If you previously changed this file, you can merge your changes:
2. Select File > Add to Model. The Add To Model window opens.
6. Click Open.
7. Because the package already exists in the model, a window opens so you can add the
package to the model under a new name, such as PredefinedTypes_new.
8. Click OK.
9. Change the property <lang>_CG::Type::LanguageMap to TBS.
12. Run DiffMerge on your original file and the new one, which is located in the <project
name>_rpy directory.
13. Add your changes to the .sbs file located in <Rational Rhapsody installation
path>\Share\Properties.
Note
The following behavior and restrictions apply to the language-dependent types.
In Rational Rhapsody in J, language-independent types are supported only as
modeling constructs. You cannot use them in actions or operation bodies.
This feature does not apply to COM and CORBA.
1. Right-click the Types category (or a package or a class) and select Edit Type Order. The
Edit Type Order in Code window opens.
4. Click OK.
This is done by scaling integer variables so that they can represent non-integral values. Rational
Rhapsody uses the 2 factorial approach to achieve this. For example, setting the bit that usually
represents 2^0 to represent 2^-3 (.125).
For each such variable, the user specifies the word-size and the precision of the variable. The
specific steps involved are described in Defining fixed-point variables.
The file is “included” into the generated code where fixed-point variables are generated.
Note: The FixedPoint profile is added with Rational Rhapsody only if you selected
the Automotive add-on during installation.
2. In the browser, right-click the element that will contain the fixed-point variables and select
Add New > General Elements > FixedPointVar.
4. Open the Features window for the new variable, and for Type select one of the fixed-point
variable types (FXP_8Bit_T, FXP_16Bit_T, or FXP_32Bit_T). (If you do not see these
types in the list, click Select and locate the relevant type in the tree that is displayed.)
5. Set the shift to use by providing a value for the tag FXP_Shift (default value is 4). (The
variable that was created already has the Fixed-Point stereotype applied to it.)
The supported operations can only be performed on fixed-point variables, and not on the
result of fixed-point calculations. For example, these are not permitted:
FXP_ASSIGN_SUM(FXP_ASSIGN_SUM(varA,varB),varC).
Operations can be performed on fixed-point variables only. If you try to use one of the
operations with a combination of fixed-point and ordinary variables, compilation errors
will result.
The shift specified can range from 0 to (word size - 1). Rational Rhapsody does not check
that the shift you entered for the variable is within this range.
When calling a function that takes a fixed-point variable as an argument, make sure that
the variable provided to the function has the same fixed-point characteristics (word size
and shift) as the defined argument.
When calling a function that returns a fixed-point variable, make sure that the return value
is being assigned to a variable that has the same fixed-point characteristics (word size and
shift) as the defined return type.
Programmers must take into account that operations on fixed-point variables can result in
an arithmetic overflow.
Programmers must take into account that operations on fixed-point variables can result in
a loss of precision.
Java enums
Rational Rhapsody allows use to include Java enums (introduced in Java 5.0) in your models.
Enums are displayed as their own category in the Rational Rhapsody browser.
1. Double-click the relevant enum in the browser to open its Features window.
4. Click the Name column to change the default name assigned by Rational Rhapsody.
5. Click the Value column to define the argument values that will be used to instantiate this
instance of the enum (if you are providing more than one argument, separate them with
commas).
7. Click OK.
After they have been defined, enum constants appear underneath the relevant enum in the browser.
Note
Rational Rhapsody does not support the definition of anonymous classes that extend enum
constants.
Code generation
Rational Rhapsody generates Java code for the enums you have defined.
Set p = getSelectedElement
Set c = p.addNewAggr("Enum", "SampleEnum")
Set a1 = c.addNewAggr("EnumValue", "FIRST_CONSTANT")
Set a2 = c.addNewAggr("EnumValue", "SECOND_CONSTANT")
In general, the procedures described in this section apply to both C++ and Java. Where there are
language-dependent differences, these differences are noted.
Note that you can use the DiffMerge tool to locate and merge template information.
1. Double-click the class in the Rational Rhapsody browser to open its Features window.
2. On the General tab, in the Class Type area, select the Template radio button.
Notice that the Template Parameters tab displays.
5. Accept the default type or select another one from the Kind list.
6. To add arguments for the template, click the Invoke Features window button to open
the Template Argument window. Note the following for the Template Argument window:
a. If you select the Use existing type check box, you can change the type and enter a
description. In C++, you can also provide a default value for the template argument.
b. If you clear the Use existing type check box, you can enter code that further refines
the argument type, for example a pointer to a type or an array of a certain type. When
entering code in the C++[Java] Declaration box, you can also see other arguments
that have been defined.
c. Click OK to close the Template Argument window and return to the Template
Parameters tab.
7. Add more templates as needed by clicking <New> on the Template Parameters tab.
8. To determine the argument order on the Template Parameters tab, use the Move Item Up
and Move Item Down buttons.
9. If there is a primary template that you want to use, select it in the Primary Template
drop-down list box. This box contains templates for which this class is a specialization. Its
parameters to be instantiated appear in the box below the Primary Template drop-down
list box.
You can define specialization parameters only if you select a template as a primary class.
Note: When you try to delete a template that has specialization, Rational Rhapsody
warns you that the template has references. If you do delete the template, such
specialization will generate an error when you check a model.
Once you have created the template class, you can begin using it directly in your code.
You can create templates in other situations. For example, you can:
Re-use any type defined for a template parameter as a type within the template.
Use the template class as a generalization, as described in Using template classes as
generalizations.
Create an operation template, as described in Creating an operations template.
Create a function template, as described in Creating a functions template.
See also Instantiating a template class.
4. On the Template Instantiation tab of the Features window, provide a value for each of
the arguments listed by selecting an item from the Value list or entering a new value.
4. Set your template parameters for your operation on the Template Parameters tab. For
detailed instructions, see Creating a template class.
Once you have created the template operation you can begin using it in your code.
3. Set your template parameters for your function on the Template Parameters tab. For
detailed instructions, see Creating a template class.
Once you have created the template operation you can begin using it in your code.
4. On the Template Instantiation tab, select a template from the Template Name
drop-down list box.
5. To view/modify the parameters for a template, double-click the template name or click the
Invoke Features window button to open the Template Instantiation Argument window.
Click OK to return to the Template Instantiation tab.
When code is generated, the template instantiation is represented by a typedef in C++ and by a
class in Java.
Note
If a nested class or attribute is marked as a template parameter, it is not generated.
Template limitations
The following limitations apply for templates:
If there is a template parameter named “T” in an operation/function, the user cannot assign
a class named “T” to the owner of the operation/function.
If there are more than one operation/function with a template parameter of the same name
under the same owner, renaming the created nested class renames all of the parameters
with this name.
For templates in a Java project, these are additional limitations:
– Wildcards are not supported.
– Bounded wildcards are not supported.
– Generic methods are not supported.
This subject describes the Rational Rhapsody Platform Integration, which lets software
developers work on a Rational Rhapsody project within the Eclipse platform. This integration is
currently available only for C, C++, or Java development in a Windows environment only and not
on Linux.
If you want to work in the Rational Rhapsody interface and use some Eclipse features, you can use
the Workflow Integration, which is the other Rational Rhapsody plug-in implementation. In this
integration, software developers work in the Rational Rhapsody product and open Rational
Rhapsody menu commands to use some Eclipse features. You can also navigate between the two
environments. This integration can be used for C, C++, and Java development in either Windows
or Linux environments. Both Eclipse and Rational Rhapsody must be open when you are using this
integration. For information about this implementation, see Rational Rhapsody projects.
Note
See the Rational Rhapsody installation instructions for Eclipse-specific installation and
set-up information.
Eclipse Ganymede
CDT plug-in for C and C++ application development
JDT plug-in for Java development
Compilers required for the development language or languages you are using
Rational Rhapsody Developer edition (multi-language)
The Platform Integration of Rational Rhapsody for Eclipse requires a multi-language Rational
Rhapsody license.
Note
The stand-alone version of Rational Rhapsody and the Rational Rhapsody Platform
Integration within Eclipse both use the same repository so that you can switch between the
two interfaces if you want.
1. In Eclipse, choose Help > About Eclipse SDK to open the About Eclipse SDK box.
2. You should see a Rational Rhapsody icon on the About Eclipse SDK box. If this icon does
not appear, you are not set up for the Rational Rhapsody Platform Integration. See the
Eclipse set-up instructions in the Rational Rhapsody installation instructions to set up for
this integration.
For descriptions of the areas in the Rational Rhapsody interface, see Rational Rhapsody Platform
Integration within Eclipse.
The Rational Rhapsody Platform Integration within Eclipse adds two Rational Rhapsody
perspectives on tabs in the upper right corner of the Eclipse IDE:
If you have the tabs for perspectives displayed in the upper-right corner, you can click a tab to go
to another perspective.
Opening perspectives
To open a different perspective manually:
2. On the Open Perspective window, select another perspective, such as Rhapsody Debug,
and click OK.
Drawing Area
Browser
Output Window
The Rational Rhapsody menu commands and drawing capabilities have been added to the Eclipse
code editing, interface customization, and other capabilities.
Debug Tasks
Variables Problems
Animation Breakpoints Animation
Animation Manager Rhapsody Log
Console Check Model
Developers can then use the Eclipse code level debugger and Rational Rhapsody design level
debugging with animation and breakpoints for a thorough and efficient debugging strategy.
Eclipse projects
The Eclipse plug-in platform integration provides Rational Rhapsody and Eclipse features for
software developers.
2. In the New Project window, select Rhapsody Project and click Next.
3. Type a name for your Rational Rhapsody project and select the language (C, C++, or Java)
from the list. In addition, you can type the name for your first object model diagram.
4. If you want to change the location of where you want to store your project, clear the Use
default location check box and then use the Browse button to navigate to another
location.
5. Click Finish on the New Rhapsody Project window when you are done defining your new
Rational Rhapsody project.
6. If the directory for your new project has not yet been created, click Yes when you are
asked if you want to create it.
Rational Rhapsody creates a new project in the work area you specified and opens the new project.
2. Expand the Rhapsody folder, select Rhapsody Project, and then click Next.
3. On the Import window, click the Browse button to open the Browse for Folder window.
4. In the Browse For Folder window, select the folder that contains the Rational Rhapsody
project that you want to import, and then click OK.
5. On the Import window, select the project that you want to open and click Finish to open
the project in Eclipse.
1. With Eclipse Model Browser displayed, right-click an element for which you want to add
an element.
2. Select Add New > (element type) from the menu depending on what type of element you
selected. (See also Filtering out file types.)
The following figures show how you can add an element to your project. While this example
shows adding a package. The same method is true for other elements, such as diagrams, files,
actors, operations, and so on.
If you want to create a new package, right-click the project for a new main package or an existing
package to create a sub package and select Add New > Package. You can add other elements
(such an object, dependence, and a class) from the menu.
2. In the Preferences window, expand the Team section of the tree structure.
3. Select Ignored Resources to display the list of file extensions that can be set to be
ignored.
4. If the list does not contain the file types you want to filter out, click the Add Pattern
button.
5. On the Add Ignore Pattern window, type the file extension using the format shown in the
following figure and click OK to add the extension to Ignored Resources.
6. Using this method, you can enter the Rational Rhapsody *.dat, *.ehl, *.rpw, and *.vba
file extensions to Ignored Resources.
7. Click OK.
1. With the model open in Eclipse, choose File > Export to open the Export window.
2. Expand the General folder, select File System, and then click Next.
3. In the File System view of the Export window, in the list in the left box:
Note: If any problems were encountered during the operation, an Export Problems
message box displays. Click the Details button for more information.
7. To see your exported files, go to the location directory for your exported files.
1. In Eclipse, set the project for which you want to import units as the active configuration.
Right-click the project and select Set as Active Project.
3. Expand the Rhapsody folder, select Rhapsody Unit, and then click Next.
4. In the Add to Model window, you can select a single file type (unit type) that you want to
import by using the Files of Type list or you can select the Rational Rhapsody project
(.rpy) to select all of the units in the project:
5. Click Open.
6. In the Add To Model From Another Project window, select the units you want and make
your applicable selections to the Add Subunits and/or Add Dependents check boxes,
and As unit or As reference radio buttons.
7. Click OK.
8. After the import is completed, a window displays the status of the import. Click Finish.
1. In Eclipse, set the project and the component as the active configuration.
2. In your Eclipse project, choose File > Import to open the Import window.
3. Expand the Rhapsody folder, select Source Code, and then click Next.
4. When the message window opens, confirm that you want to launch the Rational Rhapsody
Reverse Engineering interface, click Finish.
5. When asked to confirm that you want the reverse engineered code to be saved to the active
component and configuration, click Continue.
6. On the Reverse Engineering window, click Add Files or Add Folder to add items to be
reverse engineered.
Note: You have a choice of a flat view or a tree view for the selected items. To toggle
between the views, click the Flat View button or the Tree View button .
8. Confirm that you want to continue with the reverse engineering process, click Yes.
9. Click Finish. The reverse engineering messages display in the Rhapsody Log window.
1. With your Rational Rhapsody model open in Eclipse, choose Search > Search to open the
Search window. (You can also right-click an element in the model browser and select
Search.)
2. For the Rational Rhapsody search facility, click the Rhapsody tab. (You can also
right-click an element on the model browser and select Search inside.)
Exact string allows a non-regular expression search. When selected, the search looks for
the string entered into the search field (such as char*).
Wildcard allows wildcard characters in the search field such as * and produces results
during the search operation that include additional characters. For example, the search
*dishwasher matches class dishwasher and attribute itsdishwasher.
Regular Expression allows the use of Unix-style regular expressions. For example,
itsdishwasher can be located using the search term [s]dishwasher.
Sort items
Check the references for each item
Delete
Load
To sort the items in the list, click the heading for the column to sort according to information in
that column.
1. Double-click an item in the list to open the its Features window and highlight its location
on the model browser.
Choose Tools > Check Model and select one of these options:
– <name of active configuration>
– Selected Elements
– Configure
Right-click the active configuration and select Check.
The results display in the Check Model tab of the Output window.
As with search results, you can double-click an item on the Check Model tab to open the Features
window for the item and highlight it in the model browser.
Generate code
Rational Rhapsody uses an Eclipse IDE project for code generation. Before you can generate code,
you must perform the following tasks:
1. In the model browser, right-click an Eclipse configuration and select Create IDE Project.
2. If you have an existing Eclipse project in your work area, that project is listed in the
Existing Project list. However, you need to create a special Eclipse IDE project, so you
should select the New Project radio button.
3. Click Finish.
4. In the New Project window, select the project type based on your environment.
5. Click Next.
8. If your project type selection is different from your current perspective, an Open
Associated Perspective window opens to give you an opportunity to switch perspectives;
click Yes. If you want to keep using your currently active perspective, click No.
Generating code
After setting up the IDE project to receive the generated code, choose Code Generator >
Generate and one of these options:
<Active Configuration> (In the following figure, the active configuration is called GUI.)
Selected classes
<Active Configuration> with Dependencies
Entire Project
The system generates the requested code and displays messages in a log file.
Note: To show a complete log report, the following figure shows a very short report.
Typically, especially for the first code generation, there might be more
messages for each group (for example, the listing of code generated might be
longer).
Bidirectional changes made to the code or model are synchronized with the other.
Roundtrip changes made in the code are automatically synchronized with the
model.
Code Generation changes made in the model are updated in the code
automatically.
None turns off DMCA.
Edit code
You can edit your Rational Rhapsody code using the Eclipse editor.
1. In the model browser, right-click an item and select Edit Code to launch the
corresponding source code in the Eclipse code editor.
2. On the Eclipse code editor, highlight any items of interest and right-click to display the
editing menu.
2. Right-click and select Show in and then select one of the options. The option listed on this
submenu are controlled by the type of project displayed. For example, this option list is
for a C++ project:
Model Browser
C/C++Projects
Outline
Navigator
1. Click the Link with Editor button located at the top of the Eclipse model browser.
2. Click an item in the model browser and notice that the code for the item is immediately
displayed and highlighted in the Eclipse code editor.
In the model browser, right-click the active configuration for your Eclipse project and
select Build Configuration.
Choose Project > Build Automatically to build from Eclipse using Java or C/C++ build
tools.
Select an element or group of elements in the model browser and choose the Project menu
to display this menu and select a build option.
1. In the model browser for the project, expand the Components folder.
2. Right-click the configuration you want to animate in the configuration folder and open the
Features window.
5. Right-click the configuration you want to animate in the configuration folder and select
Generate Configuration.
Run animation
Eclipse displays the Animation Manager window with Call Stack and Event Queue and an
Animation toolbar (at the top of the Animation Manager window, as shown in the following
figure) to perform all of the Rational Rhapsody standard animation tasks, watch the animation, and
note the messages on the Animation Log tab.
Parallel development
When many developers are working in distributed teams, they often need to work in parallel.
These teams use a configuration management (CM) tool, such as Rational ClearCase, to archive
project units. However, not all files might be checked into CM during development.
Developers in the team need to see the differences between an archived version of a unit and
another version of the same unit that might need to be merged. To accomplish these tasks, they
need to see the graphical differences between the two versions, as well as the differences in the
code.
A Rational Rhapsody unit is any project or portion of a project that can be saved as a separate file.
These are examples of Rational Rhapsody units with the file extensions for the unit types:
Class (.cls)
Package (.sbs)
Component (.cmp)
Project (.rpy)
Any Rational Rhapsody diagram
Note
The illustrations in this section show the use of the Rational ClearCase Eclipse Team
plug-in. Different Team plug-ins (for example, Rational Synergy) might have different
graphical user interfaces and menus.
The Rational Rhapsody Unit View provides a hierarchical view of Rational Rhapsody model
resources as per the model structure. Use this view to perform configuration management
operations.
From the model browser, you can choose Select with Descendants in Unit View. This menu
command selects all the descendants for Unit View.
The following figure shows the result of selecting Show in Model Browser.
1. If you have multiple Rational Rhapsody models loaded, make whichever project you want
to share be the active one.
2. For the active Rational Rhapsody project, at the top-level project node in the Unit View,
choose Team > Share Project.
3. On the Share Project window, select the repository plug-in that you want to use to share
the selected project and click Next.
4. On the next window (which shows the name of the configuration management tool you
selected in the previous step), enter the required information. For example, if you are
using Rational ClearCase, specify a Rational ClearCase VOB for your project.
5. Click Finish.
6. Address any other windows that might open. For example, for Rational ClearCase, decide
which elements you want to add to source control by clearing or selecting the applicable
check boxes.
7. Click OK.
8. Restart Eclipse.
1. Before performing Team operations (such as Check In), save your Rational Rhapsody
model in the model browser.
2. For a Rational Rhapsody project in Unit View, right-click the element you want, choose
Team > (configuration management operation); for example, Team > Check Out.
3. On the window that opens, confirm the elements that you want to perform the
configuration management operation by clearing or selecting the applicable check boxes,
and then click OK.
Notice the white check mark within a green background that denotes an element that
is checked out.
Note
You can set Team plug-in related preferences through the Eclipse Preferences window
(choose Windows > Preferences).
In addition to the comparison and merge functions, this tool provides these capabilities:
Generating a report
To generate a report from the Rational Rhapsody model:
1. Choose Tools > ReporterPLUS > Report on all model elements or Report on selected
package.
2. On the ReporterPLUS Wizard: Select Task window, select the output format you want and
click Next.
3. Use the Browse button on the ReporterPLUS Wizard: Select Template window to
select a template from the template directory (for example, <Rational Rhapsody
installation path>\reporterplus\Templates) and click Next.
4. On the Confirmation window, review the report criteria, and then click Finish to produce
the report.
6. Wait while your document is generated. ReporterPLUS spends some time loading the
template and the model. Then it analyzes the model and the model element relationships.
As an open tool, Rational Rhapsody provides a high degree of flexibility in how you set up the
visual programming environment (VPE). Project properties are name-value pairs that enable you
to customize many aspects of environment interaction and code generation. You can set existing
properties, or create whole sets of new ones, to tailor Rational Rhapsody to your particular needs.
Note
This section contains generic information about the Rational Rhapsody properties and how
to work with them.
The right column indicates the type of information in the property value. Metaclasses are listed in
alphabetical order under each subject. For information on changing property values, see Rational
Rhapsody properties.
Subjects
The following table lists the Rational Rhapsody subjects.
Subject Description
Activity_diagram Controls the appearance of activity diagrams.
Animation Controls the behavior of black box animation.
ATL Controls ATL classes.
This subject applies only to Rational Rhapsody in C++.
Browser Controls the information displayed in the Rational Rhapsody
browser.
CG Controls how code is generated. These properties are
language-independent.
Collaboration_Diagram Controls the appearance of collaboration diagrams
COM Controls how mixed, distributed applications and objects find
and interact with each other over a network.
This subject applies only to Rational Rhapsody in C++.
ComponentDiagram Controls the appearance of component diagrams.
ConfigurationManagement Defines the command strings needed by various configuration
management (CM) tools to interface with Rational Rhapsody.
<ContainerTypes> Controls how items stored in containers are accessed and
manipulated.
The subject names are Java(1.1)Containers,
Java(1.2)Containers, OMContainers,
OMCorba2CorbaContainers, OMCpp2CorbaContainers,
OMCppOfCorbaContainers, OMUContainers,
RiCContainers, or STLContainers, depending on your
programming language and environment.
CORBA Controls how CORBA interacts with Rational Rhapsody.
This subject applies only to Rational Rhapsody in C++.
DeploymentDiagram Controls the appearance of deployment diagrams.
DiagramPrintSettings Controls how diagrams are printed.
Dialog Controls which properties are displayed on the Properties tab
General Controls the general aspects of the Rational Rhapsody display.
IntelliVisor Controls the IntelliVisor feature.
<lang>_CG Controls the language-specific aspects of code generation.
The subject name is C_CG, CPP_CG, or JAVA_CG.
<lang>_ReverseEngineering Controls how Rational Rhapsody imports legacy code.
The subject name is C_ReverseEngineering,
CPP_ReverseEngineering, or
JAVA_ReverseEngineering.
Subject Description
<lang>_Roundtrip Controls how changes made to the model are roundtripped to
the code, and vice versa.
The subject name is C_Roundtrip, CPP_Roundtrip, or
JAVA_Roundtrip.
Model Controls prefixes added to attributes, variables, and arguments
to reflect their type.
ObjectModelGe Controls the appearance of object model diagrams (OMDs).
QoS Provides performance and timing information.
ReverseEngineering Controls how Rational Rhapsody deals with legacy code.
RoseInterface Controls how Rational Rhapsody imports models from Rational
Rose® 98 or 2000.
RTInterface Controls how Rational Rhapsody interacts with requirements
traceability tools.
SequenceDiagram Controls the appearance of sequence diagrams.
SPARK Enables you to control the generation of SPARK annotations
from Rational Rhapsody in Ada models so they can be
analyzed by the SPARK Examiner.
Statechart Controls the appearance of statecharts.
TestConductor Controls contains properties that affect the TestConductor™
tool.
UseCaseExtensions Controls extended UCDs.
UseCaseGe Controls the appearance of use case diagrams (UCDs).
WebComponents Controls whether Rational Rhapsody components can be
managed from the Web, and specifies the necessary
framework for code generation.
Metaclasses
Under each subject, Rational Rhapsody lists metaclasses. Metaclasses define properties for groups
of things, such as attributes, classes, and configurations.
For example, under the Statechart subject and the State metaclass, the color, line_width, and
name_color properties determine the default color and line width of state boxes and the text color
of state names. The notation is Subject::Metaclass::Property; for example,
Statechart::State::Color. Note that you can always change the properties of an element in a
statechart or diagram on-the-fly (project properties specify the default appearance).
Regular expressions
Many properties use regular expressions to define valid command strings. For example, the
ParseErrorMessage property uses the following regular expression for Microsoft® environments:
([^(]+)[(]([0-9]+)[)] [:] (error|warning|fatal error)
This expression defines the rules used to parse error messages on Microsoft systems. If you
redefine properties that require regular expressions, you must use the correct expression syntax.
Regular expression syntax is defined1 as a “regular expression is zero or more branches, separated
by |. It matches anything that matches one of the branches. A branch is zero or more pieces,
concatenated. It matches a match for the first, followed by a match for the second, and so on.”
For example, the atom .* matches zero or more instances of any character (a period
matches any character).
An atom followed by + matches a sequence of 1 or more matches of the atom.
For example, the atom .+ matches one or more instances of any character.
An atom followed by ? matches a match of the atom, or the null string.
For example, the atom .? matches a single character or the null string, such as at the end
of an input string.
An atom is a regular expression in parentheses (matching a match for the regular
expression), a range, or:
– . (matching any single character)
– ^ (matching the beginning of the input string)
– $ (matching the end of the input string)
– A \ followed by a single character (matching that character)
– A single character with no other significance (matching that character)
Consider the following regular expression:
([a-zA-Z_][a-zA-Z0-9_]*)
This regular expression, enclosed in parentheses, matches a sequence of two ranges, any single
uppercase or lowercase letter, or underscore character; followed by zero or more uppercase or
lowercase letters, digits 0-9, or the underscore character.
([^(]+) This is the first token. The caret at the beginning of the set is a NOT operator that
matches any character except those in the set. This token tells the parser to ignore all
characters until the first occurrence of an open parenthesis.
[(] The parser should search for exactly one opening parenthesis.
([0-9]+) This is the second token It tells the parser to search for a sequence of one or
more digits in the range of 0 to 9.
[)] The parser should search for exactly one closing parenthesis.
[:] The parser should search for exactly one colon.
(error|warning|fatal error} This is the third token. It tells the parser to search for
one of the strings “error,” “warning,” or “fatal error.”
The ErrorMessageTokensFormat property works with ParseErrorMessage to determine how many
tokens can be contained in an error message, and the relative positions in the message string of
tokens that represent the file name and line number of the error, respectively. The second token in
the sample regular expression would most likely represent a line number, depending on how
ErrorMessageTokensFormat was defined.
Based on this regular expression, the parser would interpret the string “(3457):warning” as a
valid error message indicating a warning condition at line 3457 in the program.
“Bool”
A string that indicates a type with two possible values, TRUE or FALSE.
Makefile generation
Standard operations
Relation implementation properties
Names of generated operations
Headers and footers
Configuration management
Predefined variables
The following table lists the predefined variables used in Rational Rhapsody.
The following table lists the predefined Rational Rhapsody macros used in the framework files and
makefiles.
Macro Description
AR The command to build a library.
ARFLAGS The flags used to build a library.
CP Environment-specific copy command.
CPP_EXT Environment-specific extension for C++ implementation files (for example,
.cpp).
DLL_CMD Expands to the DLL link command that initiates the DLL link phase of a
build
DLL_FLAGS Expands to the switches applied to the DLL link command
H_EXT Environment-specific extension for C++ implementation files (for example,
.h).
Macro Description
INCLUDE_QUALIFIER The qualifier used in a given environment to designate an include file in the
compiler or link switches.
LIB_CMD The command to build a library.
LIB_EXT Environment-specific extension for library files (for example, .lib).
LIB_FLAGS The flags used to build a library.
LIB_NAME The name of a library.
LIB_POSTFIX The postfix added between the main file name and the extension. The
possible values are as follows:
• sim for simulated time (for example, oxfsim.lib)
• inst for instrumentation (for example, oxfinst.lib)
• siminst for simulated time and instrumentation (for example,
oxfsiminst.lib)
This macro is not used for DLLs.
LIB_PREFIX The prefix added to the beginning of a file name. For example, the prefix
“Vx” is added to VxWorks libraries.
This macro is not used for DLLs.
LINK_CMD Expands to the link command that initiates the link phase of a build
LINK_FLAGS Expands to the link switches applied to the link command
OBJ_EXT The environment-specific extension for object files (for example, .o or
.obj).
OBJS The intermediate object files to be built (for example, aombrk.obj).
PDB_EXT The environment-specific extension for PDB debug files (for example,
.pdb).
RM The environment-specific remove command for deleting files.
RMDIR The environment-specific remove command for deleting directories. This is
used in the clean rules when you set the
<lang>_CG::<Environment>::ObjectsDirectory property.
With a project open, choose File > Project Properties to access all the properties for a
model. The Features window displays with the Properties tab already selected.
Right-click an item in the browser or on a diagram and select Features to open the
Features window, and then select the Properties tab to list the properties for the selected
item.
In the left column, the subjects are listed in boldface font; expand the plus sign to view the
metaclasses for a particular subject. When you expand a metaclass, the corresponding properties
are listed in the left column, with their current values (if any) listed in the right column.
For example, in the figure, the ObjectModelGe::Class::ShowName property can have the values
Full_path, Relative (the default value), and Name_only.
Note that items are usually in alphabetical order; however, metaclasses that are of the same type as
the context are “pushed up” to be first. For example, if you are viewing the properties of a selected
class, the first metaclass displayed is CG::Class.
Selecting a property displays the definition for the property in the bottom pane of the window.
Each time a new property is selected, its definition displays below. Definitions are displayed for all
three of the property levels: subject, metaclass, and the individual property.
The All option displays all of the available properties for your selection. You can display only the
Overridden properties for the model or only the properties you overrode locally with the Locally
Overridden option. The Common properties are those most often changed for the selected type of
item.
The Filter menu option lets you search for specific properties by entering a filter string. Rational
Rhapsody displays only the properties that contain the text you entered. When you are filtering the
properties and select the Match property description check box, Rational Rhapsody searches the
property definitions for the string you entered, as well as the property name.
Note
The Filter mechanism is not case-sensitive and does not allow the use of wildcards or
expressions.
If you enter more than one word as the Filter, Rational Rhapsody performs an “or” search and
displays all of the properties that contain any one of the words entered. To limit the search to only
the definitions containing the entire phrase, enclose the words in the search string within quotation
marks.
As long as the Features window (or standalone properties window) remains open, the selection
you made from the menu (filter text and check box setting) is retained. When the Features window
is closed, these are reset.
In addition, you can select the vertical line separator to resize the columns for the property names
and their values. When you click the vertical separator, a solid-looking line displays so you can
control the column widths and display. You can click the horizontal separator to resize the bottom
pane of the Properties tab where the property definitions appear.
Note
Any continuation of a long “Default Value” is indented under that heading until a new table
entry begins.
Filtering views
To select the types of properties that are displayed in the Features window, you can specify the
view for the View menu.
Filtering properties
To search for specific property names or text in descriptions, select Filter from the Properties tab
View menu. This feature allows you to input and search for any text in the Property names and the
descriptions. Selecting the “Match property description” check box searches property descriptions
in addition to the names. Text located through a Filter Properties search is displayed in bold type in
the property definition area of the Features window.
1. In the properties GUI, select the All filter so you can find the property to add to the
common view.
2. Right-click the property you want to add to the common view and select Add To common
list.
To remove a property to the common view:
1. In the properties GUI, select the Common filter so you can find the property to add to the
common view.
2. Right-click the property you want to remove and select Remove from common list.
Property controls
The Property tab uses different controls depending on the value type of the property (enum,
Boolean, and so on). The following table lists the property types and the corresponding controls.
Type Control
Boolean Check box (a check mark = checked)
Color Color selection box, with samples and their RGB
equivalents
Enum Drop-down list
MultiLine Multiline edit control
Numeric value Edit box
Text string Text editing box
Overridden properties
When you override the default value of a property, the property name is displayed in purple. The
following figure shows an overridden property.
Removing an override
To remove an override:
3. Click OK.
1. Choose File > Project Properties to set properties at the project level.
or
To set properties at the component level, right-click the component whose property you
want to change, choose Features > Properties, and then select the Properties tab.
2. If wanted, select a different group of properties using the View drop-down list.
For example, to change the class code editor for your model, expand the General node in
the list of subjects, then expand the Model metaclass to locate the ClassCodeEditor
property.
4. Select the new value for the property in the right-hand column (for example, to change the
value of the ClassCodeEditor property from Internal to CommandLine).
5. Click OK.
Visibility of properties
In general, a subject is displayed for an element if it contains a metaclass that matches the
metaclass of the element. The following table lists the exceptions to this rule.
PRP files
Default properties are assigned in the factory and site default files, factory.prp and site.prp,
respectively. These files are located in the $OMROOT\Share\Properties directory and provide a
way to tune project properties on an individual or site-wide basis without recompiling Rational
Rhapsody.
Do not change the factory.prp file to make individual site requirements. Instead, change the
site.prp file for an individual site. Settings in the site.prp file will override the settings in the
factory.prp file. In this way, you can always return to factory default settings in case of mistakes.
When creating a new subject, you can keep existing metaclasses and properties intact. For
example, the subjects OMUContainers, OMContainers, and STLContainers are all different
subjects which contain the same metaclasses and properties.
Likewise, when creating a new metaclass, you can keep existing subjects and properties intact.
You can also create new properties under existing subjects and metaclasses. For example, if you
were using a testing tool that Rational Rhapsody did not support, you might create new properties
under an existing metaclass.
You can create new metaclasses and properties using existing Rational Rhapsody properties. For
example, to add a new configuration management tool to Rational Rhapsody:
2. To the comma-separated enum values string, add the name of the new CM tool.
3. If you want this tool to be the default CM tool, change the second quoted string from None
to the name of the new tool.
When you restart Rational Rhapsody, you will see the name of the new CM tool listed in
the drop-down list of the Modify window for the CM tool property.
4. Block and copy the section of code for an existing metaclass. Be sure to include the
closing “end” for the metaclass block.
6. Edit the value of every property in the new metaclass, depending on the requirements for
CM commands within the individual CM tool.
To do the final step, see the documentation for the CM tool to determine the syntax for
commands in that tool. Once you know what information the CM tool requires and the
syntax of commands in that tool, you can use regular expression syntax and Rational
Rhapsody-internal variables to create the appropriate command strings for the tool.
Note
Do not change the original settings in the factory.prp file because you would not be able
to roll back to the default settings.
2. Under the appropriate subject and metaclass, add the new property. Make sure to put in the
correct number of end statements.
3. To each metaclass, add a new property of type String or MultiLine that contains the
comment text.
If you place this information on top of your site<Lang>.prp, you benefit in the following ways:
You can add comments in the file header to document why you made changes.
Access from inside Rational Rhapsody via the Property tab to get an overview of the
version and changes inside your site properties files. However, you must keep the
comments and content in sync manually.
Gain the ability to bring site settings into the Reporter documentation.
Note
Do not use the String comment ("") inside the assigned strings of the comment properties.
Example
The following example shows a portion of the SiteC++.prp file with comment properties.
Subject SiteCPPComment
Metaclass Comments
Property RhpVersion String "v7.5 SiteC++ for Rhapsody
Build 1368921"
Property ChangeAuthor String "John Smith, Acme Co."
Property LastChange String "01.30.2009"
Property ChangeHistory MultiLine "Version 1.0
02.08.2009"
Property ChangeList MultiLine "
List of Changed Properties
Optimization Properties:
* CPP_CG->Attribute->AccessorGenerate to False
* CPP_CG->Attribute->MutatorGenerate to False
* CPP_CG->Relation->RemoveKeyGenerate to False
* CPP_CG->Relation->RemoveKeyHelpersGenerate to
False
Other properties:
* None
"
Property GeneralComment MultiLine "
Purpose of the changes in siteC++.prp:
I like challenges!
Any questions?
"
end
end
end
Include statements must be outside of a Subject block, either before or after. Therefore,
Rational Rhapsody expects every included .prp file starts with a Subject line. If not,
Rational Rhapsody generates an error.
Rational Rhapsody does not check for loops. Therefore, a loop in the include files might
cause an infinite loop when the .prp file is read.
You can nest include statements. For example:
Include "C:\Rhapsody\Share\Properties\IndividualSite.prp"
Subject General
Metaclass Model
Property BackUps Enum "None,One,Two" "Two"
end
end
Include "..\Properties\IndividualSite.prp"
Subject General
Metaclass Model
Property AutoSaveInterval Int "11"
end
end
Include "IndividualSite.prp"
Property inheritance
The level at which you set a property can affect other elements. For example, if you set a property
for a dependency at the class level, and not on an individual dependency, it applies to all the
dependencies in that class.
configuration package
operation
class
attribute
relation
Note
Note that if a stereotype is applied to an element, a property assigned to that stereotype takes
precedence over the element's inherited property values (locally overridden properties take
precedence over both inherited properties and those applied via a stereotype).
Static architectures
Several properties in Rational Rhapsody provide support for static architectures, found in hard
real-time and safety-critical systems that do not use dynamic memory management during
runtime. When these properties are used, all events (including timeouts and triggered events) are
dynamically allocated during the initialization phase. Once allocated, the memory pool (or event
queue) remains static in size during the life of the application. It is important to note that dynamic
memory management capabilities are still required in order to initialize these systems. In its
current implementation, Rational Rhapsody does not generate applications that can be run in
environments that are completely without dynamic memory management capabilities.
Properties that provide support for static architectures include the following properties:
BaseNumberOfInstances
AdditionalNumberOfInstances
ProtectStaticMemoryPool
EmptyMemoryPoolCallback
EmptyMemoryPoolMessage
TimerMaxTimeouts
IncludeFiles
The IncludeFiles property (under the <ContainerTypes> metaclasses) enables the selective
framework includes of templates based on a particular relation implementation.
If this property is defined, includes of the files listed in the property are added to the specification
files for classes participating in a relation.
Include files can also be added to class implementation files if the container is added by reference.
If the Containment property is set to Reference, a forward declaration of the container is added to
the class specification file, and the #include is added to the class implementation file. A new set
of properties that describe the forward declaration of the container is added to each container
implementation metaclass, and the necessary modifications are made to the code generation.
To enable the use of relations without templates, a set of typeless (void*) containers is supplied as
an alternative implementation. The generated code for relations that use the typeless containers is
responsible for supplying a type-safe interface.
However, supplying typeless containers does not entirely solve the problem because templates are
still included via the framework .h files. To resolve this issue, selective includes of framework
objects must be used to avoid getting the template definitions “in the back door.”
To support selective framework includes, the oxf.h file has been minimized to include only the
most basic files. The following properties have also been added:
IncludeFiles
ActiveIncludeFiles
ReactiveIncludeFiles
ProtectedIncludeFiles
StaticMemoryIncludeFiles
Reactive classes
A class is considered reactive if it:
Has a statechart
Consumes events
Is a composite
Units of collaboration
In the property descriptions, the term “unit” refers to a unit of collaboration, which can be one of
the following types:
The Executer
Several Rational Rhapsody properties include calls to the Executer to execute batch files. The
location of both the Executer and the target-specific batch makefile ($makefile) are given relative
to the $OMROOT environment variable.
The following table lists the environment variables used by Rational Rhapsody. For ease of use,
the environment variables are listed by section in the order in which they occur in the file.
For example:
[BarsLayout-Bar29]
BarsLayout-Summary section
Bars = number Specifies the number of toolbars.
For example:
Bars=30
ScreenCX = resolution Specifies the user screen resolution on the X scale.
For example:
ScreenCX=1024
ScreenCY = resolution Specifies the user screen resolution on the Y scale.
For example:
ScreenCY=768
Plugin section
MTT<Version number> = path Specifies the path to the TestConductor DLL.
For example:
MTT4.1=L:\Rhapsody\v41\
TestConductor\
TestConductor.dll
Tornado section
DefaultTargetServerName = string Specifies the default target-server name used with Tornado.
For example:
File1=J:\Rhapsody5\ProjectAda\
NewFunc\NewFunc.rpy
File2=J:\Rhapsody5\CPPProjects\
NewFunc\NewStuff\NewStuff.rpy
File3=J:\Rhapsody41MR2\AdaProject\
Dishwasher\Dishwasher\Dishwasher.rpy
Format properties
Rational Rhapsody uses properties under the Subject Format to determine the format used for
displaying various graphical elements.
These properties do not appear on the Properties tab of the Features window, but you can control
these formatting features using the Format window that is displayed when you select Format that
displays on the context menu for graphical elements. This window lets you set formatting options
up to the project level.
In some cases, you might want to set formatting options across multiple projects. This can be done
by overriding the value of formatting properties using the site.prp file.
DefaultSize - specifies the default size to use for graphical elements of this type. You can
change the default size for elements of a given type by selecting the New Element Size
check box in the Make Default window. In the value that is used for this property, the
third coordinate represents the width of the graphical element, and the fourth coordinate
represents the height of the element. For more information, see Defining default
characteristics.
Fill.FillColor - specifies the color to use to fill the background of the graphical
element. Corresponds to the Fill Color selector on the Fill tab of the Format window. For
more information, see Defining line characteristics.
Fill.Transparent_Fill - used to specify whether or not the fill should be transparent.
Corresponds to the Transparent Pattern check box on the Fill tab of the Format window.
Fill.BackgroundColor - used as the color of the superimposed pattern if you have
chosen a pattern to use for the fill. Corresponds to the Pattern Color selector on the Fill
tab of the Format window.
Fill.FillStyle and Fill.FillHatch - represent the fill pattern to use. Correspond to
the Pattern list on the Fill tab of the Format window.
Font.Font - specifies the font to use for the text on the graphical element. Corresponds to
the font list on the Font tab of the Format window.
Font.FontColor - specifies the color of the font to use for the text on the graphical
element. Corresponds to the Text Color selector on the Font tab of the Format window.
Font.Size - specifies the size of the font to use for the text on the graphical element.
Corresponds to the font size list on the Font tab of the Format window.
Font.Underline - specifies whether or not the text on the graphical element should be
underlined. Corresponds to the Underline check box on the Font tab of the Format
window.
Font.Strikeout - specifies whether strikeout text should be used for the text on the
graphical element. Corresponds to the Strike-Out check box on the Font tab of the Format
window.
Font.Weight - used for bolding of text on the graphical element. Corresponds to the bold/
italic control on the Font tab of the Format window.
Font.Italic - used for italicizing text on the graphical element. Corresponds to the bold/
italic control on the Font tab of the Format window.
Line.LineColor - specifies the color to use for the outline of the graphical element.
Corresponds to the Color selector on the Line tab of the Format window.
Line.LineStyle - specifies the style to use for the outline of the graphical element, for
example, solid or dotted. Corresponds to the Style list on the Line tab of the Format
window.
Line.LineWidth - specifies the width of the line to use for the outline of the graphical
element. Corresponds to the Width list on the Line tab of the Format window.
1. Right-click the element in a diagram that you want to use as the element pattern and select
Make Default.
2. In the Make Default window, select the Item characteristics to be copied from the
highlighted element to other elements of the same type:
Display Options
Format
New Element Size (for graphical elements only)
3. Select the Level in your project for all of the elements of that type to have the same
characteristics:
Diagram
Package
Project
4. Click OK.
2. In the Format window on the Line tab, select the Line color, style, and width.
3. On the Font tab, select the font name and other text characteristics.
A Rational Rhapsody project includes the UML diagrams, packages, and code generation
configurations that specify the model and the code generated from it. The term project is
equivalent to model in Rational Rhapsody.
This section provides an overview of a Rational Rhapsody project, the components of a project,
and the procedures to create, edit, and store projects.
Project elements
A project consists of elements that define your model, such as packages, classes and diagrams. The
browser displays these elements in a hierarchical structure that matches the organization of your
model. Rational Rhapsody uses these elements to generate code for your final application.
Components contain configurations and files and also hold the variants for different
software product lines.
Packages and profiles packages contain other packages, components, actors, use cases,
classes (C++/J), object types, events, types (C/C++), functions (C,C++), objects,
dependencies, constraints, variables, sequence diagrams, OMDs, collaboration diagrams,
UCDs, and deployment diagrams.
Creating a project
When you create a new project, Rational Rhapsody creates a folder containing the project files in
the location you specify. The name you choose for your new project is used to name project files
and folders, and displays at the top level of the project hierarchy in the browser. Rational
Rhapsody provides several default elements in the new project to get you started, such as a default
component and configuration. Before you begin, create a project folder in your file system to hold
all of your Rational Rhapsody projects.
1. With Rational Rhapsody running, create the new project by either selecting File > New, or
clicking the New project button on the main toolbar.
2. Replace the default project name (Project) with <your project name> in the Project
name field. Enter a new directory name in the In folder field or Browse to find an
existing directory.
3. The Default Project Type provides all of the basic UML structures for most Rational
Rhapsody projects. However, you can select one of the specialized Profiles, that provide a
predefined, coherent set of tags, stereotypes, and constraints for specific project types.
4. You might want to select one of the Project Settings. For example, you might want to
work in a code centric setting instead of the default model centered setting.
5. Click OK. If the directory does not exist, Rational Rhapsody asks if you want to create it.
Click Yes to create the new project directory.
Rational Rhapsody creates a new project in the <your project name> subdirectory and opens the
new project. The project name in that directory is <your project name>.rpy.
Profiles
A predefined Rational Rhapsody profile becomes part of your project in one of these ways:
You select an available profile from the Type pull-down menu, as described in the
Creating a project section.
You manually add a specialized profile to your project from the Share\Profiles directory,
as described in the Adding a Rational Rhapsody profile manually section.
Rational Rhapsody assigns a starting-point profile based on your project settings and
development environment.
The predefined profiles available to you depend on the system language and add-on products
licensed for Rational Rhapsody.
Harmony creates a project based on the Harmony (SE) Systems Engineering Process. For
more information, see Harmony process and toolkit.
IDFProfile uses the code generation settings for the Rational Rhapsody Developer for C
IDF. For more information, see Using IDF for a Rational Rhapsody in C project.
MARTE supports Model and Analysis for Real-Time Embedded systems that are not
covered by UML and annotates application models to support analysis by tools.
MODAF is the Rational Rhapsody profile for MODAF v1.1. For more information, see
IBM Rational Rhapsody MODAF Add On.
MicroC provides the facilities to run automotive C applications on systems with very
limited resources or with no operating system. For more information, see The MicroC
profile.
MISRA98 controls the code generation settings to comply with the MISRA-C 1998
standard.
NetCentric imports Web-services Definition Language (WSDL) files to design and
generate a services model. For more information, see Domain-specific projects and the
NetCentric profile. (This profile requires a separate license.)
RespectProfile can be used for C and C++ project to preserve the structure of the code
and preserves this structure when code is regenerated from the Rational Rhapsody model.
Meaning that code generated in Rational Rhapsody resembles the original. For more
information about handling regenerated code, see Code respect and reverse engineering
for Rational Rhapsody Developer for C and C++.
RoseSkin is used by Rational Rose Import to set format and other settings to resemble
Rational Rose look-and-feel.
SDL facilitates importing SDL Suite models into Rational Rhapsody SDL Blocks.
Simulink and SimulinkInC allow integration of MATLAB Simulink models into
Rational Rhapsody as Simulink Blocks (Simulink profile is for C++).
SPARK is the Rational Rhapsody Ada SPARK profile.
SPT (Scheduling, Performance, and Time) is an implementation of the SPT standard
(OMG standard) that specifies the method to add timing analysis data to model elements.
For more information, see Schedulability, Performance, and Time (SPT) profile.
StatemateBlock creates a new block/class allowing a Statemate model to become part of
a Rational Rhapsody architecture. This profile is only available for Rational Rhapsody in
C and requires a licensed version of Statemate 4.2 MR2 or greater with a license for the
Statemate MicroC code generator. For more information, see StatemateBlock in Rational
Rhapsody.
SysML supports both UML and SysML model diagrams for systems engineering. This
profile is the Rational Rhapsody implementation of the OMG SysML profile. For more
information, see Systems engineering with Rational Rhapsody.
Note: To open one of the last-opened projects, select it from the list of projects that
appear on the File menu just above the Exit command.
2. In the Look in field, browse to the location of the project.
3. Select the .rpy file, or type the name of the project file in the File name field.
4. Select the With All Subunits check box. This causes Rational Rhapsody to load all units
in the project, ignoring workspace information. For information on workspaces, see Using
workspaces.
Searching models
To search models:
1. With the model displayed in Rational Rhapsody, there are three methods to launch the
Search facility: select Edit > Search, click the binoculars button , or press Ctrl+F.
2. The Search window and perform a quick search. Type the search criteria into the Find
what field and click Find. The results display in the Output window. The search criteria
displays on the Search tab of the Output window.
3. To display the more detailed search window, select Edit > Advanced Search Replace or
click the Advanced button in the Search window (above). Both methods display this
window. The advanced search window provides the Unresolved and Units only search
features.
4. Select the Search elements tab to narrow the scope of the search to specific project
element types such as requirements, classes, packages, components, and diagram types.
5. Select the Search in tab to identify parts of the project for the search. Of course, you can
use combinations of selections on different tabs and the Find window to narrow your
search.
Exact string permits a non-regular expression search. When selected the search
looks for the string entered into the search field (such as char*)
Wildcard permits wildcard characters in the search field such as “*” produces
results during the search operation that include additional characters. For
example, the search *dishwasher matches class dishwasher and attribute
itsdishwasher.
Regular Expression allows the use of Unix style regular expressions. For
example, itsdishwasher can be located using the search term *dishwasher.
7. If after performing one search you want another Search tab with additional search results
displayed in the Output window, check the New Tab box in the Results in Output
Window area. Perform the next search.
Search results
After locating elements using the Search facility, you can perform these operations in the Search
window or in the Output window:
Sort items
Check the references for each item
Delete
Load
To sort items in the list, click the heading above the column to sort according to display that
feature of each item in the list.
2. Select References and examine the information displayed in the window, as shown in this
example:
1. Right-click an item in the search results list to display and then select Delete from Model.
The system displays a message for you to confirm the deletion.
If you have located an unloaded item in the search results and want to load it into the model, right-
click the item. Load the item in the same manner as it is loaded from within the browser.
Replacing
If you want to replace item names or other terminology throughout the model:
4. Make any additional selections to limit the search and replace process.
5. Click Find and approve or skip the possible replacements.
In this example, the developer wants a list of the ports that are used by a specific interface.
2. If you need to locate the section you want to examine, you can use Search and replace
facility to find it. Then in the browser, select the item for which you need more
information.
3. In this example, press the Ctrl-R (for relationships) accelerator keys to list the relations
with the IDoorListener interface.
4. You can sort the displayed list by the Name or Type by clicking the heading of the
column. In this example, the items are sorted by Type to show the ports grouped together.
Note
You can also use ReporterPLUS to generate a report for a selected section of your model.
Adding elements
To add elements from the browser:
1. Right-click an element, then select Add New. A submenu that lists all the elements that
can be added at the current location in the project hierarchy is displayed.
For detailed information about adding elements from the browser, see Model elements. To add
elements from a graphic editor, use the drawing tools to draw the element in the diagram. For
information on using the graphic editors, see Graphic editors.
3. The Add to Profile to Model window lists all of your available profiles, either as separate
.sbs files or in folders.
4. Select a .sbs file for the profile and click Open. The system checks to be certain that the
selected profile is compatible with the language being used in the existing project.
Rational Rhapsody lists the newly added profile in the Profiles section of the browser. If you are
not familiar with the profile, open the profile in the browser to examine its characteristics.
By default, Rational Rhapsody allows you to undo the last 20 operations, but you can set this value
in the General::Model::UndoBufferSize property. Setting this property to a value of zero
disables the Undo/Redo feature.
You cannot use the Undo command after large operations that affect the file system. The undo
operation buffer is cleared and the Undo and Redo tools are deactivated. The following operations
cannot be undone:
Adding a file unit to the model (via the File > Add to Model command)
Code generation with the “generated code in browser” option
Rational Rhapsody provides a base IDF model that can be adapted for different target systems.
Also included is a sample adaptation for Microsoft NT illustrating the use of the IDF.
1. Start the development version of Rational Rhapsody in C and choose File > Open and
browse to locate the IDF model Share\LangC\idf\model\idf.rpy.
2. With that project open, click the GMR button to generate and make the generic
configuration automatically displayed above the window, as shown here.
This generates all core files and idfFiles.list with dependencies and rules in the
Share\LangC\idf directory.
4. Generate and make this model with the GMR button. This builds the library msidf.lib in
the directory Share\LangC\lib.
Saving a project
You can save a project in its current location using File > Save or click the Save button in the
toolbar. The Save command saves all modified files in the project repository.
2. Use the Save In field to locate the folder where you would like to save the project.
3. Type a name for the project file in the window. The file extension .rpy (for repository)
denotes that the file is a Rational Rhapsody model.
4. Click Save. All project files are saved in the project repository.
Incremental save
If you want to save only the modified project units and not the entire project:
1. Select File > Project Properties and select the Properties tab.
Autosave
By default, Rational Rhapsody performs an incremental autosave every 10 minutes to back up
changes made between saves. Modified units are saved in the autosave folder, along with any units
that have an older time stamp than the project file. Modifications to the project file are saved in the
<Project>_auto.rpy file. When you save the project, the autosave files are cleared.
The autosave feature saves files in flat format. All unit files reside in the <Project>_auto_rpy
folder, regardless of the directory structure of the original model.
Renaming a project
To change the name or location of the project, use the Save As command. Do not attempt to edit
the project file directly. When you save the project under a different name, the name of the project
folder is updated in the browser.
1. In the browser, right-click the element to be renamed and select Refactor > Rename.
1. Select entries in the lower section of the preview window to see the related code displayed
above.
2. To remove a reference from the list of changes, click the check box before the reference to
remove the green check.
1. Expand the browser tree to see the change to the related elements.
2. Display the Features window for the element and check the information to be certain it has
been changed as you expected.
Closing a project
1. Select File > Close.
2. If you have unsaved changes, Rational Rhapsody asks if you would like to save your
changes before closing the project. Select one of the following options:
1. In the browser, right-click the <project name> at the top of the browser list and select
Features.
2. On the Properties tab, click the All radio button to display all of the properties for this
project.
3. Expand the General and Model property lists and locate the BackUps property.
4. Select One or Two from the pull-down menu. With this setting, Rational Rhapsody creates
up to one or two backups of every project in the project directory.
5. Click OK.
After this change, saving a project more than once creates <projectname>_bak2.rpy contains the
most recent backup and the previous version in <projectname>_bak1.rpy. To restore an earlier
version of a project, you can open either of these backup files.
2. Save the project as <Project>.rpy using the File > Save As command.
Archiving a project
At times, you might need to archive a project to send it to another developer or to Customer
Support. To create a complete archive, include the following files and directories:
<Project>.rpy file
<Project>_rpy directory with all subdirectories
<Component> directories
Any external source files (.h and .cpp) needed to compile the project
Table view performs a query on a selected element type and displays a detailed list of its
various attributes and relations.
Matrix view displays queries showing the relations among selected model elements.
These views provide the following development capabilities:
1. Select any area of the model in the Rational Rhapsody browser where you want to store a
table or matrix layout (query design).
2. Define a layout for the table or matrix (as described in the following sections) and save it
in the selected browser location.
3. Define a view of the model data using the previously defined layout. This view also gives
you the opportunity to define the scope of the query for the view.
4. In the browser, double-click the defined view to display the results of the query in the
drawing area.
5. To edit the data displayed in a view, use the Features window for the view and click the
Refresh button to update the view.
Note: Data displayed in views cannot be edited directly in a view. You must use the
Features window for a view to make your edits.
6. To export the data, right-click the data in the drawing area and select Copy.
1. Right-click the package in the Rational Rhapsody browser where you want to create and
store your table layout and select Add New > Table\Matrix > Table Layout.
Note: Add New > Table\Matrix is the default menu command structure in Rational
Rhapsody. It can be changed by users. This topic assumes that all defaults are
in place.
2. In the browser, enter a name for this table design. You might want to include the word
“layout” in the name to help identify your defined layouts from their generated views.
3. Double-click the new layout in the browser to open its Features window.
4. On the Element Types tab, select the element types you want to be displayed in the table:
5. Click Apply to save your selections without closing the Features window.
1. On the Columns tab, click the New button to create a new row in the table layout.
2. For the row, select a Type and Property from the corresponding menus for your query
purpose:
The General Attribute type might use one of the following properties (also
shown in the following figure) to define it:
– Name displays the name of an element.
– Description displays the description for an element (if there is one).
– Element type displays the element type of an element.
– From displays where an element is from.
– To displays where an element goes to.
– Via Port (From) displays the port from which a relation is connected.
Typically used along with Via Port (To). For more information, see Including
ports and multiple relations.
– Via Port (To) displays the port to which a relation is connected. Typically
used along with Via Port (From). For more information, see Including ports
and multiple relations.
The Tag type has the <<Select>> property. Click it to open the Select Tag
window in which you can identify the information for the tag. Click OK.
3. Click the New button to add each row for your table. Use the Move Item Up and
Move Item Down buttons to arrange the order of the rows in your table layout.
4. Optionally, to remove a row from the layout, select it on the Columns tab and click the
Delete button .
1. Right-click a package on the Rational Rhapsody browser to which you want to add a table
view and select Add New > Table\Matrix > Table View.
Note: Add New > Table\Matrix is the default menu command structure in Rational
Rhapsody. It can be changed by users. This topic assumes that all defaults are
in place.
2. In the browser, right-click the new table view and select Features to open its Features
window.
5. Select the scope for this view by selecting a package from the Scope drop-down list.
6. Clear or select the Include Descendants check box if you want to exclude or include the
descendants for the selected scope. For more information, see Including and excluding
descendants.
8. To make changes to the displayed data, double-click a row in the table view and make the
changes in the Features window for that element.
9. If you have finished making changes, you can use either of the following actions:
Click Apply to save your changes in the Features window and then click the
Refresh button to display the new data in the view.
If you are done making changes, click OK.
To exclude descendants from appearing in your table or matrix view, you need to clear the Include
Descendants check box on the General tab of the Features window for the particular view, as
shown in the following figure for a table view. Then (refresh the view if necessary), the view
shows without descendants.
1. On the left of the table display, click the Add model element icon.
2. In the Add new element window, select the Element type from the pull-down menu.
1. Right-click a package on the Rational Rhapsody browser where you want to add a matrix
layout and select Add New > Table\Matrix > Matrix Layout.
Note: Add New > Table\Matrix is the default menu command structure in Rational
Rhapsody. It can be changed by users. This topic assumes that all defaults are
in place.
2. In the browser, enter a name for this new matrix design.
You might want to include the word “layout” in the name to help identify your defined
layouts from their generated views.
4. On the Cell Element Types tab select only one of the possible element types. Cell element
type is the relation type between the “From” and “To” elements to be displayed in matrix
cells. In the finished matrix, the elements of that type are displayed down the left side of
the matrix view to identify a row of data.
5. Click Apply to save your selections and keep the Features window open to select the
“From” and “To” elements.
1. On the From Element Types tab, select the element types from which the connection
should be identified.
3. On the To Element Types tab, select the element types to which the connection should be
identified.
4. Click OK.
1. Right-click the package on the Rational Rhapsody browser to which you want to create
and store a matrix view and select Add New > Table\Matrix > Matrix View.
Note: Add New > Table\Matrix is the default menu command structure in Rational
Rhapsody. It can be changed by users. This topic assumes that all defaults are
in place.
2. In the browser, right-click the new matrix view and select Features to open its Features
window.
5. Select the scope for this view by selecting a package or project in the “From” Scope and
in the “To” Scope drop-down lists, as shown in this example:
6. Clear or select the Include Descendants check box if you want to exclude or include the
descendants for the selected scope. For more information, see Including and excluding
descendants.
8. In the browser, double-click the matrix view name to generate the results of the data query.
The query analyzes data for the selected package and all of its nested packages, as shown
in this example:
9. To make changes to the displayed data, double-click a cell in the matrix view and make
the changes in the Features window for that element.
10. Depending on if you are done making changes:
Click Apply to save your changes in the Features window and then click the
1. Open the Features window for the view or choose File > Project Properties to display the
properties for your project. For information about using properties in your project, see
Properties.
3. Click OK.
4. When you display a view, click the Toggle empty rows filter button to show only the
rows containing data.
If you do not want this property to be active, you would clear the check box for it.
1. Open the Features window for the table view or matrix view.
Note
When there are multiple relations, options such as Features, Locate, and so on are disabled.
1. On the left of the matrix display, click the Add model element icon.
2. In the Add new element window, select whether you want the element selection to be
Based on row settings or Based on column settings.
6. Click OK.
The revised matrix displays the new element type’s information automatically.
2. Create a table or matrix layout and design it as you want. See Creating a table layout and
Creating a matrix layout.
3. In your profile, create a stereotype and define it as a New Term and to what it is applicable
to (table view or matrix view, as shown in the following figure) and click Apply to save
but not close the window. For information on stereotypes, see Stereotypes.
6. Open the Features window for the table or matrix view you created in the previous step
and note that the layout is already identified (because of the applicable stereotype).
7. Complete your design of the view by filling in the Scope boxes, as shown here, and click
OK.
8. Look at the Rational Rhapsody browser and notice that the view you just created is listed
in a View category (in our example, MyMatrixViewStereotypes, as shown in the
following figure) other than the general Matrix Views category, which only lists those
views that were created without a stereotype (using Add New > Table\Matrix > Matrix
View):
9. When you double-click the table or matrix view (MyMatrixView in our example above),
it shows the query results from the layout that has the specified stereotype.
Features to open the Features window. For more information, see The Features window.
Locate to find the location of the element on the Rational Rhapsody browser.
Add to Favorites to add to your favorites list in Rational Rhapsody. For more
information, see The Favorites browser.
Browse from Here to open a Rational Rhapsody browser that contains a more-focused
Rational Rhapsody browser from whichever point you are at. For more information, see
Opening a Browse From Here browser.
The remaining options are standard Windows options. You might find the Copy option particularly
useful to export the view’s data into Microsoft Excel and then save it as a .csv file.
1. With Rational Rhapsody Designer for Systems Engineer running, create the new project
by either selecting File > New or clicking the New project button on the main toolbar.
2. Replace the default project name (Project) with <your project name> in the Project
name field. Enter a new directory name in the In folder field or Browse to find an
existing directory.
3. The Default Project Type provides all of the basic Rational Rhapsody Designer for
Systems Engineers edition features. However, you can select one of these specialized
Profiles to supply a predefined, coherent set of tags, stereotypes, and constraints for
specific project types:
DoDAF
FunctionalC
Harmony
MODAF
SPARK
SysML
TestingProfile
4. You might want to select one of the Project Settings. For example, you might want to
work in a code centric environment instead of the default model centered setting.
5. Click OK. If the directory does not exist, Rational Rhapsody asks if you want to create it.
Click Yes to create the new project directory.
The default Designer for Systems Engineers edition project contains a structure diagram as the
starting point. For more detailed instructions, see the Structure diagrams section.
Note
Remember that Designer for Systems Engineers can use any of the supported languages:
Ada, C, C++, or Java.
You can add the following profiles to a Designer for Systems Engineers project using the Adding a
Rational Rhapsody profile manually procedure:
AdaCodeGeneration
Backward compatibility profiles
JavaDoc
NetCentric
SDL
Simulink
SPT
For ideas for your project, examine the sample projects in following <Rational Rhapsody
installation path>\Samples:
1. With Rational Rhapsody Architect for Systems Engineers edition running, create the new
project by either selecting File > New or clicking the New project button on the main
toolbar.
2. Replace the default project name (Project) with <your project name> in the Project
name field. Enter a new directory name in the In folder field or Browse to find an
existing directory.
3. The Default Project Type provides all of the basic Rational Rhapsody Architect for
Systems Engineers edition features. However, you can select one of this limited set of
specialized Profiles:
DoDAF
FunctionalC
Harmony
MODAF
NetCentric
SysML
4. You might want to select one of the Project Settings. For example, you might want to
work in a code centric environment instead of the default model centered setting.
5. Click OK. If the directory does not exist, Rational Rhapsody asks if you want to create it.
Click Yes to create the new project directory.
The basic default Architect for Systems Engineers edition project contains a structure diagram as
the starting point. For detailed instructions, see the Structure diagrams section.
Note
Remember that Rational Rhapsody Architect for Systems Engineers edition does not use
any of the four development languages available in other Rational Rhapsody editions.
1. With Rational Rhapsody Architect for Software edition running, create the new project by
either selecting File > New or clicking the New project button on the main toolbar.
2. Select the primary implementation language as C, C++, or Java and click Next.
3. In the New Project window, replace the default project name (Project) with <your
project name> in the Project name field. Enter a new directory name in the In folder
field or Browse to find an existing directory.
4. The Default Project Type provides all of the basic Rational Rhapsody Architect for
Software edition features. However, you can select one of the specialized Profiles, that
provide a predefined, coherent set of tags, stereotypes, and constraints for specific project
types. The following profiles available for a new Architect project from the Type
selection:
CodeCentricCpp
FunctionalC
Harmony
NetCentric
SysML
You can also add the available profiles to Rational Rhapsody Architect for Software
project using the Adding a Rational Rhapsody profile manually procedure.
5. You might want to select one of the Project Settings. For example, you might want to
work in a code centric environment instead of the default model centered setting.
6. Click OK. If the directory does not exist, Rational Rhapsody asks if you want to create it.
Click Yes to create the new project directory.
For ideas for your project, you can examine the sample projects in these <Rational Rhapsody
installation path>\Samples directories.
1. In a high-level object model diagram, create a class or object for the variable component.
2. In the Features window for each variable component, select VariationPoint as the
Stereotype. In this example, the jet and heater are the variation points for the dishwasher.
Defining variants
To define one variant for each variation point:
1. For each variation point, draw its dependencies to the variant class or object.
2. For each variant class or object, display the Features window, and select Variant as the
Stereotype.
3. Complete the definition of the variant classes and objects to meet the requirements.
In this example, each variation point has two variants. Note that each of the classes and objects
contains a statechart to define the operation states.
.
The <<Static>> stereotype (on inheritance) duplicates all features of the static base class into the
static derive class including types, operations, attributes, associations, inheritances, ports,
dependencies, behavior and links.
Selecting a variant
To select a variant:
2. Display the Features window and click the Variation Points tab.
Multiple projects
Rational Rhapsody allows you to have more than one project open at a time. When you have more
than one project open, you can use the Rational Rhapsody browser to copy and move elements
from one project to another.
The following terms are used in Rational Rhapsody in the context of working with multiple
projects:
Projects is the top-level container (or folder) for all open projects in a Rational Rhapsody
session (saved as an .rpl file). The Projects folder contains the list of projects, which can
be saved and reopened.
Active Project is the project that you can currently be modify. This is also the project to
which Rational Rhapsody commands, such as for code generation, are applied (unless the
command opens a window that allows you to specify which project to use).
1. Open the existing Rational Rhapsody project into which you want to add another Rational
Rhapsody project.
3. Select Existing to insert a previously created Rational Rhapsody project for a directory.
Note: Rational Rhapsody does not permit two projects with the same name to be
incorporated.
The Rational Rhapsody browser displays a project list node called Projects that is one level above
the open projects. The currently active project name is in bold print, as shown in the following
example.
1. Open the existing Rational Rhapsody project into which you want to add another Rational
Rhapsody project.
2. Choose File > Insert Project > New to open the window for Creating a project
Note: Rational Rhapsody does not permit two projects with the same name to be
incorporated.
Once you have more than one project open, you can make any project the active project as follows:
Similar to the display of the active component and active configuration, the name of the active
project displays in bold in the browser.
You can modify an active project’s model elements only. (Rational Rhapsody displays RO, for read-
only, next to all project names in the browser that are in non-active projects.)
If you make a project active without first saving changes made to the previously active project, the
system asks you if want to save those changes. If you click the No button, your changes to the
previously active project are not yet lost. This is because when you close all the projects, the
system asks if you want to save the project list and all its projects. If you click the Yes button, all
changes made to all projects that have not been saved are saved at this time.
In general, Rational Rhapsody commands are applied only to the active project. However, the
commands Search and Locate in Browser can be applied across all open projects.
Referencing an element in another project only “links” that element to the original
element in the original project
Copying creates a element in another project that is the same as the original
Note
Copying and referencing can only be done within the browser. You cannot drag an element
from one project to a diagram in another project.
You can use either the standard Windows copying techniques, as described in Copying elements to
other projects or the Shift key method, as described in Using the Shift key to copy, reference, or
move elements.
Creating references
Only elements that have been saved as units can be referenced in other projects.
1. In the active project, right-click the element in the browser and select Create Unit.
2. Type the Unit Filename if you want to use a different name from the displayed name.
3. Click OK to create the unit and the icon of the new unit is marked with a red box. In this
example, the homeowner and intruder elements are units.
4. In the project that is going to receive the reference, right-click the project name and select
Set as Active Project.
5. In the browser of the now active project, right-click the element that needs to reference the
new unit and then select Create Unit to change the receiving element into a unit.
6. In the original project, select the unit that is being referenced. Click and drag that unit to
the active project’s new unit. When the reference is established, the (REF) symbol
displays next to the referenced element, as shown in this example:
1. In the browser, right-click the project name in the Rational Rhapsody browser from which
you are copying an element and select Set as Active Project.
2. Select the element you want to copy into the other project and select Edit > Copy or right-
click and select Copy.
3. Right-click the project name to which you are copying the element and select Set as
Active Project.
4. Select the folder where you want to store the copied element and select Edit >Paste. If the
copied element has the same name as an existing element in the new project, the name is
appended with “_copy.”
Copied elements with the same name as existing elements should be renamed to avoid confusion.
1. Be certain that the element has been saved as a unit, as described in Creating references.
2. In the non-active project, press and hold the Shift key, and click-and-drag the unit you
want to copy, reference, or move to the target project.
Copy here
Reference here, or
Move here - leave a reference
2. Press and hold the Alt key, then click-and-drag the element to the other project.
3. Rational Rhapsody checks if there will be unresolved elements in the target project as a
result of the move. If there are unresolved elements, a message box displays along with
the Output window.
4. If you click Yes on the message box, the unit moves to the target project.
Note
The original unit, that was moved, now has a (REF) tag in the source project because the
unit has been moved and the moved unit is now the unit of record in the active project.
A new .rpl file is created in the current active project folder. The name of the project list file will
be Projects.rpl. (If a file with this name already exists in the folder, a number will be added to
the end of the file name, for example Project1.rpl.)
The current active project is saved as an attribute of the project list, so when you reopen a project
list, the active project will be the project that was active when the project list was last saved.
2. If necessary, look in the path for your project, then select the relevant project list file.
Typically, the Open window displays all .rpy and .rpl files.
3. Click Open.
1. Select File > Insert Project and choose the project to add.
2. Decide if the just added project or another one should be the current active project.
Project limitations
The following items identify multiple project work and display limitations.
New project
You cannot add a new project to a list of open projects. When you select File > New, if there are
changes to be saved, you will be asked if you want to save before closing, then all open projects
will be closed, and the project list will be saved before the New Project window displays.
References window
The References window includes the references for all of the projects in the project list, and not
just those for the active project.
DiffMerge
DiffMerge does not support the comparison of project lists (that is, groups of projects).
Configuration management
Rational Rhapsody does not support the configuration management of project lists but you can use
your configuration management tool directly for a project file list.
Properties
When viewing properties, Rational Rhapsody always displays the property values of the selected
project. However, for all properties that affect more than one project, Rational Rhapsody uses the
settings of the active project. For information about using properties in your project, see
Properties.
Note: Remember that usually the names used in the Rational Rhapsody models are
going to be automatically written into the generated code. Therefore, the names
should be simple and clearly label all of the elements, and they should not use
any special characters.
Standard prefixes
Lower and upper case prefixes are useful for model elements. The following list shows common
prefixes with examples of each:
Note
Association ends and ports cannot be saved as units.
The project and all packages are always units. The following table lists other project elements that
can be units.
A unit can be part of only one Rational Rhapsody model. Therefore, a unit can be
modified in only one Rational Rhapsody model.
A unit can be referenced as often as necessary.
A unit can contain many subunits.
Each model element is identified by a Global Unique Identifier (GUID), so each unit is
unique in its model.
Only model elements that must be shared should be changed into units.
A unit’s name should be the same as its model element name. This simplifies the
association between a unit and its model element.
Changing many model elements to units might slow Rational Rhapsody processes.
To create diagrams automatically as units, change the
General::Model::DiagramIsSavedUnit property to be Checked. The default is
Unchecked.
1. Right-click the element and then select Create Unit. The Unit Information window for the
element opens with fields filled in, as shown in the following figure:
3. Edit the default Unit Filename, if wanted. Rational Rhapsody assigns the appropriate file
extension for you in the next field. The Rational Rhapsody File Extension is displayed
and cannot be changed if the unit must have a specific extension for Rational Rhapsody.
5. In the access privileges radio button area, you might want to change the default Read/
Write selection for the new unit to Read Only or External Reference.
6. The Include in next load selection is automatically checked since you are adding a unit.
7. Click OK.
The unit in the browser is now marked with a small red icon. Save the unit and the icon turns
black.
Modifying units
To modify a unit:
1. In the browser, right-click the unit to modify, then select Unit > Edit Unit. The Unit
Information for Package window opens.
3. Click OK.
To reduce the amount of time required to save a project, Rational Rhapsody marks all modified
units and enables you to save those units without saving the entire project. To indicate that a unit
has changed, the unit icon in the browser changes from black to red.
To unload a unit, right-click the subunit in the browser and select Unit > Unload [unit name].
Units that are not currently loaded are indicated by (U) before the unit name in the browser.
If you do want to unload a unit, but you want to prevent it from being loaded the next time you
open the project:
1. In the browser, right-click the unit and select Unit > Edit Unit.
2. On the Unit Information, clear the Include in next load check box.
If you open the project by selecting its name from the MRU list (under File), Rational Rhapsody
will also only load those units that were open when you completed your last session.
Note
This applies also to the Include in next load check box. If you cleared this check box,
Rational Rhapsody will refrain from loading the unit only if you select the Restore Last
Session radio button when you open the project, or open the project from the MRU list.
In flat mode, all package files are stored in the project directory, regardless of their
location in the project hierarchy.
In hierarchical mode, a package is stored in a subdirectory one level below its parent. It is
possible to have a hybrid project, where some packages are stored in flat mode, and others
are organized in a hierarchy of folders.
To set the default so that new packages are stored in separate directories:
Flat mode
In flat mode, Rational Rhapsody stores all package files in one directory. This is usually the project
directory.
If you are changing modes from hierarchical to flat, Rational Rhapsody maintains the existing
directory structure, but does not add any new subdirectories. New packages are stored within the
existing structure beneath the directory of their closest parent.
To create a new model that will be in one file, after you create the project, set the following
properties’ check boxes to be Cleared at the project level:
General::Model::BlockIsSavedUnit
General::Model::ClassIsSavedUnit
General::Model::ComponentIsSavedUnit
General::Model::DiagramIsSavedUnit
General::Model::FileIsSavedUnit
General::Model::ObjectIsSavedUnit
General::Model::PackageIsSavedUnit
Hierarchical mode
In hierarchical mode, you can save a package in a unique subdirectory one level below the
directory of its parent. All units contained in the package are saved in its subdirectory, along with
the package (.sbs) file. Nested packages are further divided into subdirectories.
Consider the example of a project Home that contains the package Family, which contains the
package Pets. With each package in its own directory, the path of the Pets.sbs file would be:
../Home/Family/Pets/Pets.sbs
Note
When changing from flat mode to hierarchical mode, Rational Rhapsody does not
automatically create folders for existing packages. Instead, it creates a folder for each new
package within the existing directory structure.
1. Right-click the package and select Unit > Edit Unit. The Unit Information for Package
window opens.
2. Select the Store in separate Directory check box (available only for packages). The name
of the separate directory has the same name as the unit.
3. Click OK.
Rational Rhapsody creates the new directory and moves the package, along with all of its subunits,
into the new folder.
Note
When you add a reference to your model, Rational Rhapsody adds the packages as top-level
packages by default. However, you can move the reference packages so they become nested
packages.
For example, you can use a relative path (..\) or the environment variable $ENV_VAR. If you set
the General::Model::EnvironmentVariables property to include the path of this environment
variable, Rational Rhapsody parses and executes that environment variable when it opens the
project, and then searches for the reference unit in the specified location.
Note
If you use relative paths, note that the path is relative to the _rpy folder, not where the .rpy
file is located.
Rational Rhapsody automatically opens the References in Read-Only Files Encountered window
when it detects that an attempt to delete an element might cause unresolved references. When you
delete an element (for example, through the Rational Rhapsody browser or a graphic editor) that
has references in read-only files, the References in Read-Only Files Encountered window opens
with a list of read-only files that contains references to the deleted element.
Check out the selected and continue - Use only if you have a configuration management
tool set.
Note: This option might fail if the unit you are trying to check out is not already
checked in.
Note: This option is unavailable in the Rational Rhapsody Platform Integration.
Make the selected files read/write and continue
Ignore the references in read-only files and continue. Using this option means that
unresolved references might be created when the model is reloaded.
Using workspaces
Workspaces enable you to work with selected units of a project without having to open the entire
model. This feature supports component-based development and collaboration among teams. It
also reduces the time required for routine operations, such as saving and code generation, by
enabling you to load only the units currently under development.
In addition, workspaces save viewing preferences, including window size, position, status of
feature windows, and the scaling or zoom factor of open diagrams.
2. In the Look in field, browse to the location of the project, then select the .rpy file.
Alternatively, type the name of the project file in the File name field.
3. Select the Without Subunits check box. This prevents Rational Rhapsody from loading
any project units. All project units will be loaded as stubs.
4. Click Open. The project file opens with no units loaded. This empty project acts as a
starting point for you to create your workspace.
Unloaded units
Units of your project that have not been loaded into your workspace are marked with the letter
“U.” This designation means that the unit is a stub unit, and was either excluded from the project
intentionally, or was not found when Rational Rhapsody attempted to load the unit.
You can use the Advanced search and replace features to locate any unloaded units and load them.
2. In the Look in field, browse to the location of the project, then select the .rpy file.
Alternatively, type the name of the project file in the File name field.
3. Select the Restore Last Session check box. The project opens with the workspace
information that was saved during your last Rational Rhapsody session.
To open a project without loading workspace information, see Opening an existing Rational
Rhapsody project.
To prevent Rational Rhapsody from saving graphic editor settings, set the
OpenDiagramWithLastPlacement property under General::Workspace BlockIsSavedUnit
check box to Cleared. With this setting, Rational Rhapsody does not save the position of graphic
editor windows. Instead, it uses the default window settings the next time you open a graphic
editor.
You can prevent Rational Rhapsody from saving any window preferences by setting the
OpenWindowsWhenLoadingProject property under General::Workspace check box to Cleared.
Engineers in the team need to see the differences between an archived version of a unit and another
version of the same unit or a similar unit that might need to be merged. To accomplish these tasks,
they need to see the graphical differences between the two versions, as well as the differences in
the code. However, source control software does not support graphical comparisons.
The Rational Rhapsody DiffMerge tool supports team collaboration by showing how a design has
changed between unit revisions and then merging units as needed. It performs a full comparison
including graphical elements, text, and code differences.
Unit types
A Rational Rhapsody unit is any project or portion of a project that can be saved as a separate file.
These are some examples of Rational Rhapsody units with the file extensions for the unit types:
Class (.cls)
Package (.sbs)
Component (.cmp)
Project (.rpy)
Any Rational Rhapsody diagram
The units being compared only need to be stored as separate files in directories and accessible
from the PC running the DiffMerge tool. In addition to the comparison and merge functions, this
tool provides these capabilities:
Note
Many of the DiffMerge tool’s operations can be run from a command-line interface to
automate some of the tasks associated with software development (for example, to schedule
nightly builds).
You can, however, open Rational Rhapsody projects that were created with other language
versions of Rational Rhapsody.
In addition, Rational Rhapsody allows a single model to contain units that are associated with
different languages. A model can include units associated with C, C++, or Java. Code can then be
generated in the appropriate language for each unit.
Note
While project migration is a built-in feature of Rational Rhapsody, you can only have multi-
language projects if you possess the special license required for this feature.
When you try to open a project that was created in a different language version of Rational
Rhapsody, you are notified that the project will be converted to the language of the current version,
and you are asked whether you would like to continue with the conversion of the project.
Note
When you migrate a project, you do not lose any language-specific features of model
elements that are not supported in the language version of Rational Rhapsody that you are
running. These language-specific characteristics will not be displayed, for example, in the
Features window, and any code generation will be in the language of the current version not
the version with which the model was originally created. However, Rational Rhapsody
maintains this information. If, at a later stage, you reopen the model in the original
language, you will once again see these language-specific characteristics.
When a project is migrated, bodies of operations and any other code entered manually in Rational
Rhapsody are not converted to the target language. If you already have such code in your model
before the migration, make sure to convert the code in order to avoid compilation errors.
If you use Add by reference to add a unit whose language differs from that of the version of
Rational Rhapsody you are running, a non-persistent conversion is performed (since these
elements are read-only). This non-persistent conversion will be performed each time you open the
model.
Note
If you have a license for multi-language projects, no conversion is performed when you
open a model from another language version of Rational Rhapsody. If you would like to
convert an entire project, just change the unit language at the project level. For details, see
Determining language of a unit in multi-language projects.
Multi-language projects
Rational Rhapsody uses units to permits projects to contain components from different
development languages. Each unit is associated with a specific language.
1. Right-click the unit in the browser, and then select Unit > Edit Unit.
2. When the Unit Information window is displayed, select the language from the list.
3. Click OK.
If you are changing the language of a unit that contains subunits, Rational Rhapsody will ask you
if you also would like to change the language of all of the contained subunits.
Note
As is the case for project migration, if you change the language of a unit, you do not
permanently lose any language-specific features of the unit. These language-specific
characteristics will not be displayed, and any code generation will be in the new language.
However, Rational Rhapsody maintains this information. If, at a later stage, you switch the
unit back to the original language, you will once again see these language-specific
characteristics.
When you move units of one language to a package of another language, Rational Rhapsody will
inform you that they are different languages and will ask you to confirm the move.
If you try to add a unit that is associated with another language, Rational Rhapsody will ask you to
confirm the addition of the unit. You will also be prompted for confirmation if you add “by
reference” a unit that is associated with another language.
Code generation
In each of the language versions of Rational Rhapsody, you can generate code for units in each of
the three languages - C, C++, Java.
For code generation to work properly, you have to adhere to the following rules:
To generate code for units in a certain language, the appropriate language must be
specified at the component level.
Elements included in the scope of a component must be of the same language as the
component. (If other language elements are included in the scope, a warning will be
issued during code generation.)
Note
If you select All Elements as the scope, Rational Rhapsody will automatically include only
those units whose language matches that of the component. If you choose Selected
Elements, Rational Rhapsody will only display those units whose language matches that of
the component. However, if you selected specific elements, and then changed the language
of the component, Rational Rhapsody will not deselect these non-matching units. When you
attempt to generate code with such a component, you will receive error messages.
The same principle applies to the Initial Instances specified for the configuration.
Similarly, the properties displayed reflect the language of the selected unit.
Non-unit elements
If you try moving an element not saved as a unit to a package with a different language, the
language of the element will be changed to that of the receiving package after you confirm that you
want to move the element.
Reverse engineering
The reverse engineering mechanism always uses the language of the active component. When you
use the Reverse Engineering window to add files to reverse engineer, the default file filter used
will reflect the language of the active component, for example, *.java if the active component is
associated with Java.
Miscellaneous issues
Rational Rhapsody API: The interface IRPUnit allows recursive changing of unit
language.
ReporterPLUS can query the language of an element.
The Rational Rhapsody internal reporter shows the language of each saved unit.
XMI: Language of each unit is exported and imported.
Graphic Editor: Changes to language of a unit do not affect the depiction of the unit in the
graphic editor. For example, if you change the language of a template class to C, it will
still look like a template class in the graphic editor.
DiffMerge checks for language differences.
PredefinedTypes package: These packages are language-dependent. When you create a
unit whose language differs from that of the Rational Rhapsody version being used, the
relevant package of predefined types for that language will be loaded.
Unfortunately, WSDL requires that the data types be fully defined and contain legal XML types.
WSDL also requires the developers to define the interface calls in terms of where the services are
to be deployed (bindings and namespaces). These details are not always known during the initial
design phase. The Rational Rhapsody NetCentric profile helps the engineer bridge this gap from
the design concepts to the WSDL file production.
Service consumers
A service consumer can be any actor, application, or any other receiver of the deployed service.
For example, a weather station might receive the weather information provided by a SOA
application.
Using the platform independent WSDL files for application output, service users gain access to the
output more easily than from output in a proprietary format.
Service provider
The service provider is the code that implements the service. The service provider includes the
interface specification (also called the service contract) and the related WSDL file. The service
provider also includes everything necessary to produce the WSDL file:
Collaborations in a top level or System of Systems model allow the systems engineers to confirm
the data types, interfaces, and basic block behavior before generating the WSDL file. Executing
the model ensures that both sides of the interface interpret messages the same way. This avoids
consistency errors that, otherwise, might not be discovered until late in the integration phase.
The systems engineers and designers might model data types using the SysML units and value
types, as shown the Block Definition diagram example (from Rational Rhapsody System samples
“NetCentricWeatherService” project):
The Generate WSDL Specification tool uses these data types to create the schema information
within the WSDL file.
1. With your Rational Rhapsody edition running, create the new project by either selecting
File > New, or clicking the New project button on the main toolbar.
2. Replace the default project name (Project) with <your project name> in the Project
name field. Enter a new directory name in the In folder field or Browse to find an
existing directory.
4. You might want to select a different option for the Project Settings.
5. Click OK. If the directory does not exist, Rational Rhapsody asks if you want to create it.
Click Yes to create the new project directory.
1. With the Rational Rhapsody project open, choose File > Add Profile to Model.
2. In the Add to Profile Model window, select the Package (*.sbs) file for the NetCentric
profile. (If the NetCentric.sbs file is not displayed in the Profiles directory, the project
you have created is not compatible with the NetCentric profile. The SysML project profile
is often used with the NetCentric profile.)
2. In the browser, right-click the interface block or class and select Features.
3. In the Stereotype field, select <<New>> and enter serviceContract. Click OK.
4. Create the block or class that realizes the serviceContract. Apply the stereotype
<<serviceProvider>> to it.
5. Add a standard port to the <<serviceProvider>>. Set the port to provide the service
contract interface. Stereotype this port <<servicePort>>.
4. Enter the name and location for the output of WSDL specification file. Specify the target
output file with the .wsdl extension.
5. Click OK.
When the export is complete, you can open the WSDL file in any editor.
1. With the Rational Rhapsody project open, choose Tools > Import WSDL Specification.
Enable the construction of models that could be used to make quantitative predictions
regarding these characteristics.
Facilitate communication of design intent between developers in a standard way.
Enable interoperability between various analysis and design tools.
The SPT.rpy model provided in <Rational Rhapsody installation
path>\Share\Profiles\SPT is the Rational Rhapsody implementation of the standard profile that
you can use in any Rational Rhapsody model.
Note
This functionality can only be used with Rational Rhapsody in C++.
4. Click Open.
5. On the Add To Model From Another Report window, select the As reference radio button.
6. Click OK.
Rational Rhapsody adds the SPT profile as a reference profile to your model. As a result, the
stereotypes and tagged values of the profile become available.
2. Assign the stereotype you want to the model element (for example, RTclock).
3. Set tag values through the Tags tab of the Features window for the element.
Note
Deleting a stereotype or changing its metaclass might result in unresolved references in the
models using it (that is, the models that are referencing the SPT model and have elements
with this stereotype).
Eclipse
Visual Studio
Tornado
Rational Rhapsody provides some standard menu commands to setup and work within both
environments.
IDE options
Use the Code > IDE Options on the Rational Rhapsody menu to set the ports to receive and send
messages for the IDE and Rational Rhapsody and synchronize the IDE with Rational Rhapsody.
1. Open Rational Rhapsody and in the Rational Rhapsody browser, right-click the
configuration that you want to convert to be an Eclipse configuration and then select the
Change to > Eclipse Configuration.
2. From this point, the process is the same as creating a new Eclipse configuration.
Outline
Navigator
1. Create a new Rational Rhapsody project, or open an existing Rational Rhapsody project.
4. Select the projects that you would like to export to Rational Rhapsody. (If an Eclipse
project has already been imported into Rational Rhapsody, it will not appear in the list of
available Eclipse projects.)
5. If you want the elements in the project to be added to the Rational Rhapsody model as
external elements, select Export as External.
6. If you want to fine-tune the reverse engineering options that will be used for importing
your Eclipse project, select Open Reverse Engineering options dialog in Rhapsody
before export.
7. Click Finish. All of the elements in the Eclipse project will be imported into the open
Rational Rhapsody project.
8. When the import process has been completed, look in the Rational Rhapsody browser for
a package that has the same name as the Eclipse project you imported. You will also
notice that a new component has been added to your Rational Rhapsody model,
containing an Eclipse configuration named after your Eclipse project.
2. In the Rational Rhapsody browser, right-click the Component in the Rational Rhapsody
project for which you want to create an Eclipse configuration and then select Add New >
Eclipse Configuration. The system displays a window, asking whether or not the user
wants to launch the IDE if it is not running.
Note: If IDE is already running, be certain that the ports for Eclipse and Rational
Rhapsody match by selecting the Code > IDE options from the Rational
Rhapsody menu and making any changes required. If the ports do not match, a
new IDE might open even if the user meant to switch to the running IDE!
3. For the WindRiver version of Eclipse, the Workspace Launcher displays so that you can
select a directory for your Eclipse project workspace. Click OK to save the selected
directory.
4. Then the Rhapsody Project Wizard displays. It lists the name of the Rational Rhapsody
project and the component you selected for the new Eclipse configuration. Select whether
you want to create a New Project or an Existing Project. Click Finish.
5. The New Project window displays Wizard types. However, currently only the vXWorks
Downloadable Kernel Module Project is supported. Select it and click Next.
6. Type a Project name and select a workspace in this window. Complete setting up the
Workbench project, as described in the Workbench documentation.
7. The Application Development interface displays the Eclipse configuration of the selected
Rational Rhapsody component.
8. Back in Rational Rhapsody, the browser now contains the new Eclipse configuration.
1. Check the path to Eclipse in the rhapsody.ini file to be certain that it is the actual path on
your system. The following example shows a typical path:
[IDE]
EclipsePath=C:\eclipse\eclipse.exe
Note: If it does not match your path to Eclipse, make the necessary changes.
2. Check to be certain that the c:\cygwin\bin is in your environment PATH variable.
4. Right-click the component and choose Add New > Eclipse Configuration.
5. You are prompted for a workspace. Then the Rhapsody Project Wizard asks you to either
specify a project or create a new one. Click Next.
7. Click Finish.
8. If the program asks if you want to associate with a C++ Perspective, click Yes. Now the
Eclipse CDT IDE is open and linked to your Rational Rhapsody project.
9. Switch to Rational Rhapsody and make sure your Eclipse configuration is active. Generate
code.
10. Right-click a model element in the Eclipse version of the code and select Locate in
Rhapsody. This change should trigger a roundtrip in the Rational Rhapsody version of
the code if the change is not one of the Workflow integration with Eclipse limitations.
Then entry that stores this information is called EclipsePath and it is located in the section [IDE].
During installation, you will be asked to provide the path for Eclipse, and this information is
copied to the rhapsody.ini file, for example:
EclipsePath=l:\windriver\workbench-2.4\wrwb\2.4\x86-win32\bin\wrwb.exe
If you want to switch between the generic Eclipse and Wind River Workbench, change the value of
this entry in the rhapsody.ini file.
IDEName is the name of the type of integrated development environment (for example,
Eclipse, Workbench).
IDEProject is the project name entered while creating the Eclipse configuration.
IDEWorkspace is the workspace directory for the Eclipse-based project.
The values of the tags are set automatically after the IDE project is created or mapped to the
configuration. You do not need to modify the values of these tags, unless you change the IDE
workspace location in the file system. If you make that change, then you must update the
IDEWorkspace tag manually. For instructions to make this change if necessary, see Configuring
Rational Rhapsody for Eclipse.
2. Select Features from the menu to display this window. This version of the Features
window contains the IDE, Tags, Properties, and Settings tabs for use with Workbench
projects.
3. The IDE tab provides two important features:
Open in IDE launches Eclipse with the corresponding project or simply bring the
IDE forward.
Build configuration in IDE sets the build to be performed via the IDE (by
sending a request to the IDE)
4. However, if you want to perform the build in Rational Rhapsody, use the Settings tab to
make the build selections.
5. Generally, you do not need to change the values for the Tags, unless you change the
IDEWorkspace directory location. In that case, you must make the change to the path in
the window and click OK.
1. Open the Rational Rhapsody project that contains the Eclipse configuration and make it
the active configuration.
2. Launch Workbench.
3. In Rational Rhapsody, right-click a class and select Edit code in Eclipse from the menu.
4. The implementation of that class is then displayed in Eclipse, and Eclipse automatically
generates a file in DMCA mode in Rational Rhapsody.
5. Edit the code as needed. The updates are recorded in the implementation of the class.
1. Open the Rational Rhapsody project that contains the Eclipse configuration and make it
the active configuration.
2. Launch Workbench.
3. In Rational Rhapsody, right-click a model element, such as an attribute for a class in the
browser, and select Locate in Eclipse from the menu.
Note: Only those elements that can be edited in Rational Rhapsody can be opened for
editing in Eclipse.
1. In the list of C/C++ or Java projects in Eclipse, right-click the project and then select
Rhapsody > Disconnect from Rhapsody.
2. Click OK.
When you return to Rational Rhapsody, you are asked whether you want to delete the
corresponding Eclipse configuration from your model.
Note
In Rational Rhapsody, if you delete the Eclipse configuration from the model, the Eclipse
project will automatically be disconnected from the model.
Integration of the Tornado IDE provides a seamless development workflow between Rational
Rhapsody and Tornado through the following functions:
Downloading and reloading an image directly to the target from Rational Rhapsody.
Synchronizing Rational Rhapsody breakpoints and Tornado breakpoints:
– Tornado (gdb) is aware of Rational Rhapsody-based breakpoints (break on
state).
– Rational Rhapsody is alerted for source-level breakpoints from Tornado.
This appendix provides information on the following topics:
IDE properties
1. Open Tornado, then select Tools > TargetServer > (server name).
2. In Rational Rhapsody, make sure the active configuration is set to VxWorks.
Code > Target > Connect opens a connection to the IDE server. In the case of Tornado,
this is the Tornado target server. This should be applied once during a session. The
connection is disconnected either explicitly or when the project is closed. To connect, you
must specify a target server name, typically <targetName>@<hostName>. Once specified,
the name is stored for future sessions.
Code > Target > Download downloads an image to the targets through the IDE.
Download is available only if an image exists.
Code > Target > Run. Runs the executable on the target starting from a designated entry
point (VxMain in Tornado), as specified by the
<lang>_CG::<Environment>::EntryPoint property. You can also run the executable
from the Code menu or toolbar.
Code > Target > Unload clears the target from all tasks and data allocated by the
application. This is an important feature because RTOSes generally do not have a process
concept that cleans up after termination of the application. Unload is always available and
causes execution to stop if the application is running.
Code > Target > Disconnect disconnects from the IDE server.
1. In Rational Rhapsody, connect the application by selecting Code > IDE > Connect.
4. In the Animation toolbar, select Go Idle (or Go Step several times) so the tRhp task is
created.
Note: You must run the application before attaching a debugger; otherwise, there will
be no tasks to which to attach the debugger.
5. In Tornado, start the debugger by selecting Tools > Debugger.
6. Attach the debugger to the main thread (tRhp) by selecting Debug > attach.
7. From the debugger, change directory to the generated code directory (using the cd
command in the gdb prompt).
8. From the debugger, load the symbols of the executable (using the add-symbol-file
command at the gdb prompt).
Now you can use gdb to debug the application, set breakpoints, and so on.
Before quitting animation on Rational Rhapsody, you must detach the debugger using Debug >
Detach. Failing to detach the debugger might block the session once Rational Rhapsody attempts
to unload the image.
Note
Do not download the executable to the target using the debugger. Rational Rhapsody will
not function properly if you use this method.
IDE properties
The following Rational Rhapsody properties (under <lang>_CG::<Environment>) determine IDE
settings:
HasIDEInterface
If this property is set to Cleared, no IDE services are attempted and IDE support is
disabled. If the property is Checked, it is expected that the IDEInterfaceDLL property
points to an IDE adapter that provides connection to the IDE. This property can be used to
disable the IDE connection. By default, it is set to Checked only for the VxWorks
environment.
IDEConnectParameters
This property specifies the IDE connection parameters. If this property is defined,
Rational Rhapsody will use the connection parameters from this property instead of the
.ini file.
IDEInterfaceDLL
This property points to the IDE adapter DLL. Currently, there is no reason to modify the
value of this property.
Note
The naming convention for an SDL signal adds the “_” prefix to the signal’s original name.
This prefix can be modified by changing the SDLSignalPrefix property in the
Model::Profile group.
By default the SDLBlock uses behavioral ports. This configuration can be changed to use a rapid
port instead by selecting the UseRapidPorts property for the package. This property is also stored
in the Model::Profile group that you access from the Properties tab of the Features window.
Note
The SDL models you import into Rational Rhapsody cannot contain more than a single
instance of any given process.
To import an SDL model into Rational Rhapsody:
1. In the SDL Suite, open the SDL model. Mark the System level rectangle.
5. Activate the “Make” to generate the model C file (modelname.c) and environment header
file (modelname.ifc).
6. Select SDLAccess Code Generator configuration and activate the Full Make to generate
the model SDL_Access file (modelname.sac).
11. Enter the locations of the SDL model files you created previously, as shown in the
following example:
13. To connect the Rational Rhapsody block to an SDLBlock, create a user class with
behavior ports and a statechart. The statechart controls the user class’ sending and
receiving of events to and from the SDLBlock.
14. Create objects from the SDLBlock and the Rational Rhapsody block and connect their
ports via links using the interfaces that where created by the import.
15. To create an executable, perform a code generation and build on the entire Rational
Rhapsody model. Code generation scope should contain only one SDLBlock.
Note
Since the SDLBlock is imported as a “black box,” no animation is provided with this block.
There is an option to view the behavior of the SDLBlock as a wrapper via a sequence
diagram. This can be done by checking the AnimateSDLBlockBehavior property, located in
the Model::Profile property group.
The Rational Rhapsody browser lists all the design elements in your model in a hierarchical,
expandable tree structure, enabling you to easily navigate to any object in the model and edit its
features and properties. The Rational Rhapsody browser also takes part in animation by displaying
the values of instances as they change in response to messages and events.
To help you manage large and complex Rational Rhapsody projects, and to be able to focus on and
easily access model elements of particular interest to you, you can filter the Rational Rhapsody
browser or create other browser views.
Because a Rational Rhapsody project can get quite large and complex, you might want to filter
what you see on the Rational Rhapsody browser or otherwise create other browser views.
To open the Rational Rhapsody browser manually, use any of the following methods”
Click the Show/Hide Browser button on the Rational Rhapsody Windows toolbar.
Select View > Browser.
Press Alt+0 (zero).
The display mode for the project is stored in the Browser::Settings::DisplayMode property.Set
the property to Meta-class for Categories mode or Flat for Flat mode.
Expanding a category while in Flat mode reveals a flat list of elements of all types included under
that category. For example, expanding a package category reveals a simple list of the elements
contained in the package, such as actors, classes, and events, arranged alphabetically by name.
2. Choose View > Browser Display Options > Organize Tree > Categories.
3. To select all of the elements in the component, click the All Elements radio button.
If you select a check box for an element, all of the elements that it contains are included in the
component scope (for example, all of the classes in a package). If you want to be able to select sub-
elements individually, right-click the check box of the parent element.
3. Click OK. The elements of the active component within the scope are shown in bold type,
as shown in the following figure:
Name (if
Icons Description
available)
Folder Used to group and organize project elements.
Folder that is a The square in the lower left corner indicates that this folder is a unit. For information,
unit see Using project units.
Folder of For more information, see Hyperlinks.
hyperlinks
Component that The square in the lower left corner indicates that this component is a unit.
is a unit
Active Component that is a unit and is set as the active component with a red check. To
component be the active component, a component must be either an Executable or a Library
build type. For more information, see Active component.
Executable application or a library
Actor Represents an end user of the system, or an external component that sends
information to or receives information from the system. For more information, see
Actors.
Class Defines the attributes and behavior of objects. For more information, see Classes.
Class attributes
Class operations
Name (if
Icons Description
available)
Event An asynchronous, one-way communication between two objects (such as two
classes). For more information, see Events and operations.
Use case Captures scenarios describing how the system could be used. For more information,
see Use cases.
SuperClass Marks a class that inherits from another class. For more information, see
Inheritance.
Dependency Notes the relationship of a dependent class to a model element or external system
that must provide something required by the dependent class. For more information,
see Dependencies.
Constraint Supplies information about model elements concerning requirements, invariants in a
text format.
Stereotype A type of modeling element that extends the semantics of the metamodel.
Stereotypes must be based on certain existing types or classes in the metamodel.
For more information, see Stereotypes.
Type A stereotype of class used to specify a domain of instances (objects) together with
the operations applicable to the objects. A type cannot contain any methods. For
more information, see Types.
State An abstraction of the mode in which the object finds itself. It is a condition or situation
during the life of an object during which it satisfies some condition, performs some
activity, or waits for some event. For more information, see States.
Initial Marks the default state of an object. For more information, see Transitions.
Connector
Controlled file Files produced in other programs, such as Word or Excel, that are added to a project
for reference purposes and then controlled through Rational Rhapsody. For more
information, see Controlled files.
Association Defines a semantic relationship between two or more classifiers that specify
connections among their instances. It represents a set of connections between the
objects (or users). For more information, see Creating associations.
Flow port Represents the flow of data between blocks in an object model diagram (OMD)
without defining events and operations. Flowports can be added to blocks and
classes in object model diagrams.
Profile Applies domain-specific tags and stereotypes to all packages available in the
workspace. For more information, see Profiles.
Requirement verification
Tags Adds information to certain kinds of elements to reflect characteristics of the specific
domain or platform for the modeled system. For more information, see Use tags to
add element information.
Name (if
Icons Description
available)
Flow item
Table layout Shows the design for a table view of project data.
For more information, see Table and matrix views of data.
Table view Displays project data in the predefined table layout.
Matrix layout Shows the design for a matrix view of project data.
Activity diagram Shows the lifetime behavior of an object, or the procedure that is executed by an
operation in terms of a process flow, rather than as a set of reactions to incoming
events. For more information, see Activity diagrams.
Collaboration Displays objects, their messages, and their relationships in a particular scenario or
diagram use case. This diagram is also a unit. For more information, see Collaboration
diagrams.
Component Specifies the files and folders that components contain and defines the relations
diagram between these elements. For more information, see Component diagrams.
Deployment Shows the configuration of run-time processing elements and the software
diagram component instances that reside on them. For more information, see Deployment
diagrams.
Object model Shows the static structure of a system: the objects in the system and their
diagram associations and operations, and the relationships between classes and any
constraints on those relationships. For more information, see Object model
diagrams.
Requirements Shows requirements imported from other software products or created in Rational
diagram Rhapsody and illustrate the relationships between requirements and system
artifacts. For more information, see Creating Rational Rhapsody requirements
diagrams.
Sequence Describes message exchanges within your project. For more information, see
diagram Sequence diagrams.
Statechart Defines the behavior of objects by specifying how they react to events or operations.
For more information, see Statecharts.
Structure Models the structure of a composite class; any class or object that has an object
diagram model diagram can have a structure diagram. For more information, see Structure
diagrams.
Use case Illustrates scenarios (use cases) and the actors that interact with them. The icon in
diagram this example indicates that this use case diagram is also a unit. For more
information, see Use case diagrams.
To display the filter menu, click the down arrow button at the top of the browser. Whatever view
you have selected is reflected in the label to the left of the arrow button.
Note
If the browser is filtered, you can add only elements that appear in the current view.
Entire Model View is the default view and it does not use a filter. It displays all model
elements in the browser.
Use Case View displays use cases, actors, sequence diagrams, use case diagrams, and
relations among use cases and actors.
Component View displays components, nodes, packages that contain components or
nodes, files, folders, configurations, component diagrams, and deployment diagrams.
This view helps you manage different components within your project and assists with
deploying them.
Diagram View filters out all elements except diagrams. It displays all the diagrams,
including statecharts and activity diagrams.
Unit View displays all the elements that are also units. This view assists with
configuration management. For information on creating and working with units, see
Using project units.
Loaded Units View displays only the units that have not been loaded into your
workspace. For more information, see Loading and unloading units and Unloaded units.
Requirement View displays only those elements with requirements.
Overridden Properties View displays only those elements with overridden properties.
To learn about other browser views, see The Browse From Here browser and The Favorites browser.
1. Select the items in the main Rational Rhapsody browser or the Browse From Here
browser.
2. Right-click and select Delete from Model or choose Edit > Delete from the main menu.
3. Click OK.
Note
Delete from Model is not available for the Favorites browser (see The Favorites browser).
You can select one or more items and choose Edit > Delete from the main menu to delete
items from the Favorites browser (which is the same if you right-click and select Remove
from Favorites from the pop-up menu). However, this only means that you are removing
items from the Favorites browser. You cannot delete any model elements through the use of
the Favorites browser.
The Browse From Here browser operate in the same manner as the main Rational Rhapsody
browser, and it has the same look-and-feel. You can drag-and-drop between the main Rational
Rhapsody browser and one or more Browse From Here browsers.
The one feature that a Browse From Here browser has that the main Rational Rhapsody browser
For another method to help you view and access only those model elements you are most
interested in, see Rational Rhapsody browser menu options and The Favorites browser. Note that
you can have the main Rational Rhapsody browser, the Favorites browser, and one or more
Browse From Here browser open at any time.
To open a Browse From Here browser, right-click a model element in the main Rational Rhapsody
browser, the Favorites browser, on a diagram, or another Browse From Here browser and select
Browse from here.
Note
Browse From Here is not available for elements inside sequence diagrams and
collaboration diagrams that are view-only elements.
To close a Browse From Here browser, click the Close button for that browser.
Note that View > Browser is only for the main Rational Rhapsody browser.
To set the root to the parent of the current root, click the Up One Level button . Note that, if
you want, you can click this button as many times as needed to go to the project root folder (so that
your Browse From Here Browser ends up looking exactly like your main Rational Rhapsody
browser).
Note
The Favorites browser is available only for the stand-alone version of Rational Rhapsody
While the Favorites browser resembles the Rational Rhapsody browser and has some of its
functionality (for example, double-clicking an item on the Favorites browser opens the applicable
Features window, the view is refreshed when an item is renamed, it can be docked and undocked,
and so on), the Favorites browser has limited functionality (for example, there is no filtering
mechanism, certain commands, such as Cut, Copy, Paste, Add New, and Unit are not available,
and while you can remove items from the Favorites browser, you cannot use it to delete a model
element from your model).
Note
You cannot use the Favorites browser as a replacement for the Rational Rhapsody browser.
Your favorites list is saved in the <projectname>.rpw file, while the visibility and position of the
Favorites browser are saved in the Rhapsody.ini file, so that when you open the project the next
time, your settings will automatically be in place. When multiple projects are loaded, the Favorites
browser shows the favorites list for the active project.
Favorites toolbar
The Favorites toolbar provides tools for the Favorites browser. To display or hide this toolbar,
choose View > Toolbars > Favorites.
Tool
Name Description
Button
Show/Hide Toggles between showing and hiding the Favorites browser.
Favorites
Add to Select a model element and then click this button to add what you selected to your
Favorites Favorites browser.
Click the Show/Hide Favorites button on the Favorites toolbar. The button acts as an
on/off toggle.
Select View > Favorites. This menu command acts as an on/off toggle.
Add an item to your favorites list. This automatically opens the Favorites browser. See
Creating your Favorites list.
To hide the Favorites browser, use any of the following methods:
Select a model element in the Rational Rhapsody browser, the Browse From Here
browser, or on a diagram and click the Add to Favorites button on the Favorites
toolbar. (This toolbar should display by default. If it does not, choose View > Toolbars >
Favorites).
Right-click a model element in the Rational Rhapsody browser or on a diagram and select
Navigate > Add to Favorites.
Select a model element in the Rational Rhapsody browser, the Browse From Here
browser, or on a diagram and press Ctrl+d.
With the Favorites browser open, click the Add to Favorites button and then select
one or more items to add from the Select Items to Add to Favorites window. Note that
with this method, if you have a folder structure for your favorites list, you can specify
where to put a new favorite by selecting that folder (or the root node, Favorites) first in
the Favorites browser. Otherwise, your favorite is added to below the non-folder item you
have highlighted on the Favorites browser. See Creating a folder structure for your
Favorites.
With the Favorites browser open, right-click the root node (Favorites) or a folder and
choose Select Item to Add. See Creating a folder structure for your Favorites.
Click a model element on the Rational Rhapsody browser, the Browse From Here browser,
or on a diagram and drag it onto the Favorites browser. You can drop the dragged item
anywhere on the Favorites browser. See Re-ordering the items on your Favorites list.
Note
You cannot put a model element on your favorites list more than once. For example, if you
have ElementA in FolderA and you add ElementA to FolderB, the element is removed from
FolderA so that it can reside in FolderB. See Creating a folder structure for your Favorites.
In addition, Add to Favorites is not available for elements inside sequence diagrams and
collaboration diagrams that are view-only elements.
1. Open the Favorites browser (see Showing and hiding the Favorites browser).
2. Wherever you want to add a folder, click the New Folder button or right-click an item
on the Favorites browser and select Add New Folder. At this time, you can name your
folder.
3. Once you have added an item (at any level), you can add a subfolder for that item if you
want.
Select an item on your favorites list and click the Move Up or Move Down buttons
on the Favorites browser.
Note: This method is not available for folders.
Right-click an item on your favorites list and select Move Up In Favorites or Move
Down in Favorites.
Note: This method is not available for folders.
Select one or more items on your favorites list and drag it to where you want to drop it. An
insertion line displays to indicate where you can drop it.
To drop an item into an empty folder or the root node (Favorites), move your pointer over
the folder so that it becomes highlighted and then drop your item.
Note
The item is removed once you execute the action. If you change your mind, you can add the
item to your favorites list again (see Creating your Favorites list).
To remove items from your favorites list, select one or more items on the Favorites browser and
then use any of the following methods:
You cannot give a name that is different from the referenced element to a favorite (like you
can for a hyperlink or a favorite in a regular Web browser).
Since you can put different model elements with the same name on your favorites list,
there is a chance for confusion. To try to avoid this, notice the icon to the left of the model
element name. The icons provide you with a clue as to what type of model item you have
on your favorites list.
Elements
Primary model elements within the browser are packages, classes, OMDs, associations,
dependencies, operations, variables, events, event receptions, triggered operations, constructors,
destructors, and types. Primary model elements in OMDs are packages, classes, associations
(links), dependencies, and actors.
Rational Rhapsody in C and C++ classes and their instances are replaced by C equivalent object
types and objects, respectively. Similarly, class constructors and destructors are replaced by
initializers and cleanup operations.
Adding elements
In the browser, you can add new elements to the model either from the Edit menu or from the
pop-up menu. The location you select in the browser hierarchy determines which model elements
you can add. The new element is added in the scope of the current selection.
Select the project folder or a package, then select Edit > Add New > Component.
Right-click the project folder or a package and then select Add New > Component.
Note
If the browser is filtered, you can add only elements that appear in the current view.
When you add a new association end, a window opens so you can select the related model element.
1. Right-click the actor and then select Add New > Association End. The Add Association/
Aggregation window opens.
2. From the list, select the actor (or class) with which the current actor needs to
communicate.
3. Click OK.
When you create a new element, Rational Rhapsody gives it a default name. You can edit the name
of your new element by typing a new name directly in name field in the browser, or by opening the
Features window and entering a new name in the Name field.
1. Click the new element in the browser to open the name for editing.
You can also select one of these options for the menu that is available when you are renaming an
element:
Browser settings
When you open an existing project in a newer version of Rational Rhapsody, the system adds a
compatibility profile in the Settings folder, as shown in this example.
For more information about the Settings folder and profiles, see Profiles.
Components
A component is a physical subsystem in the form of a library or executable program. It plays an
important role in the modeling of large systems that contain several libraries and executables. For
example, the Rational Rhapsody application has several dozen components including the graphic
editors, browser, code generator, and animator, all provided in the form of a library.
A component contains configurations and files. In the Rational Rhapsody hierarchy, a component
can be saved at the project level, or grouped within a package.
Configurations
A configuration specifies how the component is to be produced. For example, the configuration
determines whether to compile a debug or non-debug version of the subsystem, whether it should
be in the environment of the host or the target (for example, Windows versus VxWorks), and so on.
For more information, see Component diagrams.
Configuration files
Configurations manifest themselves as files. The ability to map logical elements to files enables
you to better specify implementations for code generation, and to capture existing
implementations during reverse engineering. Just as it might be desirable to map several classes
into a single package, so might it be desirable to map one or more packages into a single
subsystem. You control where to generate the source files for the classes (or packages) in a given
subsystem, either into a single directory or separate directories.
Packages
A Rational Rhapsody project contains at least one package. Packages divide the system into
functional domains, or subsystems, which can consist of objects, object types, functions, variables,
and other logical artifacts. Packages do not have direct responsibilities or behavior; they are
simply containers for other objects. They can be organized into hierarchies, providing the system
under development with a high level of partitioning. When you create a new model, it will always
include a default package, called “Default,” where model elements are saved unless you specify a
different package.
Do not allow packages to become unmanageably large. Break them into subpackages.
Limit dependencies across packages. One way to do this is to use interfaces in their own
packages.
Creating a package
To create a package:
1. Right-click the project or the package category, then select Add New > Package.
2. Edit the name of the package using the package label in the browser.
5. Select an object model or use case diagram as the main diagram for a package from the
Main Diagram list.
In the generated code, this text becomes a comment located after the #define statements
and before the #include statements at the top of the .h file for the package.
Using functions
The Functions category lists global functions, which are visible to all classes in the same package.
2. Select Add New > Function. A new function displays under the Functions category of the
selected package.
1. Right-click the function/operation and choose Features to open the Features window.
Using objects
Objects are instances of classes in the model and can be used by any class. They are typically
created in OMDs, but can be added from the browser. For instructions on creating an object in an
OMD, see Object model diagrams.
To create an object
2. Select Add New > Object. The new object is displayed in the browser with the default
name object_n.
3. Optionally, rename the new object.
Using variables
Global variables are visible to all classes in the same package.
Note
Exercise caution when using global variables. If a global variable is used for a counter in a
shared library and multiple threads or processes can access the counter, inaccurate results
might occur if the global counter is not protected by a mutex or semaphore.
Creating a variable
1. Right-click the name of a package or the Variables category in the browser.
Define your constants using types. For example, assume a type named PI with the
following declaration:
const double %s = 3.14
In this syntax, the %s is replaced with the name PI.
A DEGREES_PER_RADIAN type would have the following declaration:
const double %s = 180.0 / PI
In this syntax, the %s is replaced with the name DEGREES_PER_RADIAN.
Because Rational Rhapsody allows you to change the order of the type declarations
such that PI is generated first, the compilation is successful.
Create a variable called PI of type const double with an initial value of 3.14. Create a
second variable called DEGREES_PER_RADIAN of type const double with an initial value
of 180.0 / PI. This will not compile because Rational Rhapsody generates the
DEGREES_PER_RADIAN variable before the PI variable.
initialize the variable in the implementation file. The default setting (Default) causes the
initialization to be put in the specification file if the type declaration begins with const;
otherwise, it is placed in the implementation file.
Dependencies
Dependencies are relations in which one class (the dependent) requires something provided by
another (the provider). Rational Rhapsody supports the full dependency concept as defined in the
UML. Dependencies can exist between any two elements that can be displayed in the browser.
Dependencies can be created in diagrams or in the browser.
Constraints
UML constraints provide information about model elements concerning requirements, invariants,
and so on. Rational Rhapsody captures them in text format. For more information, see Annotations
for diagrams.
Classes
Classes define the attributes and behavior of objects. Classes can also be created in the object
model or collaboration diagram editors. For more information, see Creating classes.
Types
The Types category displays user-defined, rather than predefined, data types. Rational Rhapsody
enables you to create types that are modeled using structural features instead of verbatim,
language-specific text.
Receptions
A reception specifies the ability of a given class to react to a certain event (called a signal in the
UML). Receptions are inherited. If you give a trigger to a transition with a reception name that
does not exist in the class but that exists in the base class, a new reception is not created.
Events
An event is an asynchronous, one-way communication between two objects (such as two classes).
Events inherit from the OMEvent abstract class, which is defined in the Rational Rhapsody
framework. Events can be created in sequence diagrams, collaboration diagrams, statecharts, or
the browser.
Actors
An actor represents an end user of the system, or an external component that sends information to
or receives information from the system. Actors can be created in UCDs, OMDs, collaboration
diagrams, and the browser.
Use cases
A use case captures scenarios describing how the system could be used. It usually represents this
scenario at a high conceptual level. Use cases can also be created in the use case diagram editor.
Nodes
A node represents a computer or other computational resource used in the deployment of your
application. For example, a node can represent a type of CPU. Nodes store and execute the run-
time components of your application. In the model, a node can belong only to a package, not to
another node (that is, nodes cannot be nested inside other nodes).
Files
A file is a graphical representation of a specification (.h) or implementation (.c) source file. This
new model element enables you to use functional modeling and take advantage of the capabilities
of Rational Rhapsody (modeling, execution, code generation, and reverse engineering), without
radically changing the existing files. For more information, see Configuration files.
Diagrams
A project has separate categories in the browser for object model, sequence, use case, component,
deployment, structure, and collaboration diagrams. Additionally, all of these diagrams (except
collaboration diagrams) can be grouped under a package.
Note: Statecharts and activity diagrams are displayed within the class they describe.
To add new statecharts and activity diagrams, select the class name in the
browser instead of the package.
Adding diagrams
To add a new diagram to an existing package:
3. Type the name of the new package in the highlighted area in the browser.
4. Right-click the new package and select the Add New > Diagrams submenu.
5. Select the type of diagram you would like to add. The New Diagram window opens.
7. If you want to populate the new diagram automatically with existing model elements.
Click the Populate Diagram check box.
8. Click OK. If you selected Populate Diagram, another window displays to allowing you
to select which model elements to add to the diagram. Rational Rhapsody automatically
lays out the elements in an orderly and easily comprehensible manner.
9. The new diagram displays in the drawing area of the Rational Rhapsody window.
Note: These steps are the same from any code view window, except that you would
select the element from the code. For an example, see Example of Locate On
Diagram from code view.
1. Right-click an element in the Rational Rhapsody browser and select Locate On Diagram.
2. Notice that Rational Rhapsody opens a diagram in which the element (Elevator) is
displayed.
Note: The theBuilding element in the code view half of the following figure is
selected for illustrative purposes. You can place your cursor within the letters
of the element name or that particular line of code and right-click to select
Locate On Diagram.
1. Open the main diagram of the element if the main diagram is set and does show the
element (as illustrated in the previous figure).
2. For an object, show the main diagram of its class if the main diagram is set and does show
the object.
4. Look for its container only if it does not find the element on the diagram. For example, if
you try to locate an operation, Rational Rhapsody looks for a diagram that shows the class
for the operation.
In this format, <ns> can be either a package or a class. Primary model elements are packages,
classes, types, and diagrams. Names of nested elements are displayed in combo boxes in the
following format:
<name> in <ns1>::<ns2>::...<nsn>
You can enter names of nested elements in combo boxes in the following format:
<ns1>::<ns2::<name>
Once you have assigned a label, Rational Rhapsody uses it in place of the element name in
diagrams and dialogs by default. Reports display both the element name and the element label.
Note
The General::Graphics::ShowLabels property controls whether labels are displayed in
diagrams and dialogs.
To set the project properties to use an Asian language font for text input:
3. From the View menu, select Filter and search property names for “font.”
4. Right-click on the font name and description that needs to be changed and click the
browse button to display the Font window.
5. Check to be certain that the font supports the Asian language you want to display. If the
font does not support the required character set, select a new font from the Font list, such
as MS Gothic that supports Kanji characters required for Japanese.
6. Also in the Font window, check the Script selection and use the pull-down menu to select
the correct language, as shown in this example.
7. Click OK save the change. Make this same change to any other font properties that are
required.
1. Right-click the selected element in the browser. (You can double-click to display the
Features window immediately.)
2. Select Features from the menu to display the Features window for the selected element.
In this example, the developer is labeling an event.
3. Click the L button next to the Name field. The Name and Label window displays.
4. Type the text in the Label field. The read-only Name field displays the name of the
element for reference.
5. Click OK twice.
Note
Remember that these labels do not have any meaning in the generated code and are used
only as references to locate elements in diagrams and windows.
1. Right-click the selected element in the browser. (You can double-click to display the
Features window immediately.)
3. Click the L button next to the Name field to open the Name and Label window.
5. Click OK twice.
Alternatively, you can set the label to have the same value as the Name. In this case, the label
becomes tied to the name. In this way, any changes made to the element name also affect the label.
Label mode
Rational Rhapsody differentiates between element names, which are used in the generated code,
and element labels, which are just used to represent elements in a user-friendly way within the
Rational Rhapsody interface.
Ordinarily, you must provide an element name, even if you are providing a label, and the name
must satisfy certain criteria, such as not containing spaces or special characters.
If you would like to deal exclusively with labels, you can select View > Label Mode. In this work
mode, you only have to provide a label for elements. Rational Rhapsody automatically converts
the label to a legal element name, replacing any characters that cannot be used in element names.
The text that you entered as the label will be shown in the browser, graphic editor, and the Features
window.
Note
When Label Mode is selected, Rational Rhapsody ignores the radio button selected under
Display Name in the Display Options window. Label Mode is a per-user setting. If the
project is opened on a different user's computer, it is displayed in normal mode unless that
user has selected Label Mode.
Modify elements
You can move, copy, rename, delete, and re-order elements. In addition, you can display
stereotypes of model elements, create graphical elements, and associate an image file with a model
element.
Moving elements
To move elements, use any of the following methods:
You can move all elements within the browser by dragging-and-dropping them from one
location to another, even across packages.
You can move a group of highlighted items to a new location in the project by dragging
and dropping them into that location in the browser.
In addition, you can drag-and-drop packages, classes, actors, and use cases from the
browser into diagrams.
If code has already been generated for a class or package, you can open the code by
dragging and dropping the class or package from the browser into an open editor, such as
Microsoft Word™, Visual C++, Borland C++, or Notepad. If the code exists, the standard
“+” icon displays as you drag the element into the editor. If the “+” icon does not appear,
most likely code has not yet been generated for the element. If the element has both a
specification and an implementation file, both files are opened.
See Smart drag-and-drop.
Note
Do not try to open the code for a class or package by dragging it from an object model
diagram because this removes the element from the view.
Copying elements
To copy elements, use any of the following methods:
Copying an element into the same namespace, such as within its own package, creates a copy with
the suffix _copy appended to its name. For example, copying a class Sensor into the same package
as the original creates a class named Sensor_copy. Subsequent copies have a suffix of _copy_<n>,
where <n> is an incremental integer starting with 0.
Copying an element into a different namespace creates a copy with exactly the same name.
Renaming elements
Renaming requires a valid name that does not already exist. An appropriate message is displayed if
either condition is not met, and the name reverts to its previous value.
There are two methods for renaming elements. You can edit the Name box of the Features window
or you can edit the name directly in the browser.
2. Click once again to open the name field for editing. An edit box opens with the name
selected, as shown in the following example.
3. Edit the name and press Enter, or click once outside the edit field to complete the change.
3. Click Apply, or anywhere outside of the Features window, to apply the new name.
4. Click OK.
Note
Do not use this method to rename the project.
Deleting elements
The Edit menu on the diagram editors contains the Remove and Delete menu commands.
Edit > Remove removes an object from a particular view but not from the model, whereas Delete
deletes the item from the entire model. In the browser, Delete always deletes an object from the
entire model, including all diagrams.
To delete an object from the entire model while in the browser, use any of the following methods:
1. In the browser, highlight the elements that are all members of the Attributes, Types,
Dependencies, Packages, Operations, or Classes metatype.
2. Right-click and select Features. The Features window displays as Multiple Selection
with only the General tab accessible. (The Name and Label fields are disabled.)
3. Type the change to common element items such as the stereotype, description, or type
definitions.
Note: If all of the selected elements have the same values, the new values are applied
to all. However, if the selected elements have different values, the Multiple
Selection window uses the Keep Original Values option to pinpoint those
areas containing varying values. Select this option to keep the different values
in the selected elements when the change is applied.
4. Click OK.
Note
Currently, Rational Rhapsody allows you to rearrange all model elements except for
statechart-related elements and activity diagram-related elements.
By default, the ability to reorder elements in the browser is disabled. To enable element reordering,
select View > Browser Display Options > Enable Order from the menu.
2. Click the Up or Down arrow in the browser toolbar to move the element.
Note
The Up and Down arrows are only displayed after you have selected a movable model
element. If the element is at the top of a category, only the Down arrow is accessible when
you are selecting the element. If the element is at the bottom of the category, only the Up
arrow is available upon selection.
From the menu, select View > Browser Display Options > Show Stereotype > All
At the project level, modify the property Browser::Settings::ShowStereotypes. The
possible values for this property are No, Prefix, Suffix.
Note
When All is selected, the property is assigned the value Prefix. When None is selected,
the property is assigned the value No. If you want the stereotype name displayed after the
element name, this can only be done by changing the property directly to Suffix.
If you select the option First, then for elements with more than one stereotype, only the first
stereotype is displayed in the browser.
The default setting for the property Browser::Settings::ShowStereotypes is Prefix. For
projects created with Rational Rhapsody 6.0 or earlier, this property is overridden and set to No.
This settings does not apply to stereotypes that are defined as “new terms.” When a stereotype is
defined as a “new term,” it is given its own category in the browser, and any elements to which this
stereotype is applied are displayed under the new category.
To create a graphical representation for an element that is listed in the browser, but not shown in
the diagram:
1. Locate the element in the browser that is not currently graphically represented in a
diagram. Highlight and drag the element into the diagram.
2. The element displays in the diagram, where you can use the Features window to make any
changes and additions to the description for the element.
3. If they can be connected semantically, you might also link the new graphical element to
other diagram elements in the diagram. For example, a stereotype can connect to another
stereotype for inheritance.
Moving the element into the diagram functions as a move of a class or object.
1. Right-click the relevant element in the browser, and then select Add Associated Image.
2. When the file browser window is displayed, select the appropriate image file.
To display the image associated with an element in a diagram, rather than the regular graphical
representation:
3. Choose Use Associated Image or, alternatively, choose Select an Image and click ... to
open the file browser.
To enable the display of associated images at the diagram level, set the property
General::Graphics::EnableImageView to Checked. The default value is Cleared.
When using an associated image in a diagram, there are a number of ways the image can be
displayed:
Image Only displays the image instead of the regular graphic representation.
Structured displays the image within the regular graphic representation.
Compartment displays the image within a compartment together with the other items that
are displayed in compartments, for example, attributes and operations.
To select one of these layout options:
3. Click OK.
To set the image view layout at the diagram level, select the appropriate value for the property
General::Graphics::ImageViewLayout. The default value is ImageOnly.
Open Image allows you to view the image in an external viewer. The application that is
opened is determined by two properties. If the property General::Model::ImageEditor
is set to the value AssociatedApplication, the default application for this type of file
will be launched. However, if this property is set to ExternalImageEditor, the
application launched will be the application specified with the property
General::Model::ExternalImageEditorCommand. The value of this property should be
the command-line for launching the relevant application.
Replace Image displays a file browser, allowing you to select a new image file to
associate with the model element, replacing the current associated image.
Remove Association breaks the association between the model element and its associated
image file.
Smart drag-and-drop
This section describes how to operate the Rational Rhapsody smart drag-and-drop feature. It
provides step-by-step instructions for performing smart drag-and-drop operations.
To drag-and-drop a class:
2. Click a class in the browser and while holding the mouse button down, drag the class onto
another class; before releasing the mouse button press the Shift key.
Note
You must press and hold the Shift key before releasing the mouse button when dragging-
and-dropping a class.
3. A context submenu displays. Select the wanted option. In the example, the Tank class is
being dragged onto the AbstractFactory class.
5. Once a selection is made from the submenu, the browser opens the feature added (in this
case, the dependency).
6. If the class selection (Tank) were being made a superclass, it would appear a
dependency added as a superclass.
.
7. If the class selection (Tank) were being copied to another class (Abstract Factory), it
would appear as shown in the following figure. Note that the class attributes for Tank
remain intact.
To display new search results in a separate tab of the Output window, select the New Tab check
box and enter new search results and click Find.
You can also highlight an item in the browser and search only in that part of the project by
selecting Edit > Search In. If you want to perform more complex searches, click Advanced in
this window.
2. Select Edit >References. The Relations window opens, listing the locations of the
element in the model.
If the element is not used anywhere in the model other than in the browser, Rational Rhapsody
displays a message stating that the element is not referenced by any element.
References option returns only model elements that actually reference the specified element; it
does not return references to the textual name of the element. To do a text-based search for the
element name, use the search and replace functionality described in Searching in the model.
Note
You can also display the list of references by using the keyboard shortcut CTRL+R.
All search results display in the Output Window with the other tabbed information. Search and
replace results display at the bottom of the Find window, as shown in the example. For more
information about the uses of this facility, see Advanced search and replace features.
2. Enter the Find what and Replace with text in those two fields.
3. Click Auto Replace. The changes display at the bottom of the window.
This automatic replacement also performs an automatic commit of the changes into the Rational
Rhapsody model so that you do not need to apply the changes manually. However, it does not
display any ripple effects of the change.
The Auto Replace feature cannot be used on the following items because they do not qualify to be
replaced automatically:
Read-only elements.
A description that includes hyperlinks
Stub or unresolved element names
The name of an event reception, constructor, destructor, generalization, or hyperlink
1. Choose Edit > Advanced Search and Replace to display the Advanced Search and
Replace window.
3. Select any or all of the element types listed in the scrolling area. Use the Select All, Clear
All, or Invert to select element types quickly.
5. Highlight an item in the search results and right-click to perform either of these
operations:
7. You can also highlight an item and perform an Auto Replace, as described in Using the
auto replace feature.
1. Choose Edit > Advanced Search and Replace to display the Advanced Search and
Replace window.
2. On the Search in tab, select the types of fields you want to find in the model by checking
them in the list at the top of the window.
3. The Element name, User code, and Other text check boxes display the fields associated
with them. For example, if only User code is checked, only the code-related fields
(Actions, Configuration initialization, Initial value, Operation bodies, and Type
declarations) are checked. Similarly, if only Other text is checked, only the text-related
fields are checked. The possible values are as follows:
Comment specification scans all the comment specifications for the specified
string
Configuration initialization scans all the configuration init code segments for
the specified string
Constraint specification scans all the constraint specifications for the specified
string (Chinese, Korean, Taiwanese, and Japanese are supported in this field and
stored as RTF.)
Descriptions scans all the descriptions for the specified string
Enumerationliteral value scans the literal value of the enumeration type for the
specified search string.
Initial value scans the initial value fields for attributes and arguments for the
specified search string
Label scans all the labels for the specified search string
Locally overridden property scans the locally overridden properties for the
specified search string.
Multiplicity scans the Multiplicity field of associations for the specified search
string.
Name scans all the element names for the specified search string
Operation bodies scans operation bodies, including operations defined under
classes, actors, use cases, and packages for the specified search string
Requirement specifications scans all requirement specifications for the specified
search string. (Chinese, Korean, Taiwanese, and Japanese are supported in this
field and stored as RTF.)
Tag Value scans the value of the tags for the specified search string.
Activity Flow Label scans all activity flow code (action, guard, trigger) for the
specified search string.
Type declarations scans all the user text in “on-the-fly” types for the specified
search string.
4. You can also specify that the Element name, User code, and Other text be included or
excluded from the search.
5. Click Find to list the fields that meet your search criteria at the bottom of the window.
Find Next highlights the next occurrence of the string in the same file.
Replace replaces the highlighted occurrence of the original string with the replacement
string specified on the Find/Replace tab.
Replace All replaces all occurrences of the string.
Apply applies the changes done in the Preview tab (editing or replacing text) to the
Rational Rhapsody model.
Cancel cancels the search and replace.
Auto Replace automatically replaces all occurrences of the highlighted string with a
replacement string.
Note
If you make a mistake, select Edit > Undo to undo the changes.
Controlled files
Rational Rhapsody allows you to create controlled files and then use their features.
The model in this section uses the “Cars” C++ sample (available in the <Rational Rhapsody
installation path>\Samples\CppSamples\Cars) to demonstrate how to use controlled files.
Controlled Files, such as project specifications files (for example, Microsoft Word,
Microsoft Excel files) are typically added to a project for reference purposes and can be
controlled through Rational Rhapsody.
A controlled file can be a file of any type (.doc, .txt, .xls, and so on).
Controlled files are added into the project from the Rational Rhapsody browser.
Controlled files can be added to diagrams via drag-and-drop from the browser.
Currently, only Tag and Dependency features can be added to a controlled file.
By default all controlled files are opened by their Windows-default programs (for
example, Microsoft Excel for .xls files).
The programs associated with controlled files can be changed via the Properties tab in the
controlled files window.
1. To select the way a controlled file is created, double-click a package in the Rational
Rhapsody browser and select the Properties tab from the Features window.
2. With the All filter selected, expand the section Model and expand the ControlledFile
subsection. The property NewPolicy controls the way a controlled file is created. The
default selection is SystemDefault. The property can be set to UseOpenCommand or
UseRhapsodyCodeEditor.
SystemDefault: This setting lets the program (as done in hyperlink, for example),
open the file according to the MIME-type mapping.
UseOpenCommand: This setting means that double-clicking on the controlled
file runs the open command. The open command is set in the OpenCommand
property (Model/ControlledFile/OpenCommand). This is a string property that
expands the keyword $fileName to the full path of the Controlled File. In the
event of property inconsistency, where the program is set to run the
UseOpenCommand but the command contains no setting, the SystemDefault
policy will be used.
UseRhapsodyCodeEditor: This setting allows the file to be opened within the
internal Rational Rhapsody code editor.
If you want to open the controlled file after it is created, set the value of the property
OpenFileAfterCreation to yes. The file will open the file immediately after it is created.
Note: Add New > Annotations is the default menu command structure in Rational
Rhapsody. It can be changed by users. This topic assumes that all defaults are
in place.
2. Navigate to the wanted file and click the Open button. Unless the controlled file being
selected is located in the right location under the _rpy directory (cars_rpy in the example),
a message displays asking you for permission to copy the file. If you do not want the file
copied into the _rpy directory, you must place the original into the _rpy directory before
selecting it from the Rational Rhapsody browser.
3. A window displays asking you for permission to copy the file into the _rpy directory.
Click OK.
5. Controlled files can be added to the graphic interface (right window pane) via drag-and-
drop from the browser.
Note: Add New > Relations is the default menu command structure in Rational
Rhapsody. It can be changed by users. This topic assumes that all defaults are
in place.
2. Make a selection in the window that displays and click OK.
1. Drag the controlled file from the browser into the graphic pane, if you have not already
done so.
2. Using the dependency icon , draw a dependency line from the controlled file to the
wanted object.
2. The Features window displays. Click the Tags tab and enter the name of the tag in the
“Quick Add” section at the bottom of the window. Click the Add button.
3. Click OK.
4. Expand the Controlled File by clicking on the “+” next to it in the browser.
5. The Tags listing displays. Click the “+” next to the Tags listing to see the new Tag you just
created.
Configuration management
Configuration management options are as follows:
Configuration
Feature Description
Management Feature
Add to Archive This feature is used when a you want to add a new file into the
configuration management server for the first time. After that, other
users can check in/out, lock/unlock the file.
Check In This feature checks the file into the configuration
management server so that other users can modify the file. You still
have read-only access to the file, but you cannot modify it.
Check Out This feature checks the file out of the configuration management
server so that other users cannot modify the file. Other users can open
the file for read-only
purposes.
Lock This feature locks the file so that other users cannot modify it in the
future. Only you can unlock the file.
Unlock This feature unlocks the files so that other users can modify the file in
the future. Only you can unlock the file.
Question: “I checked out a controlled file. But I am not able to change its description,
properties, and so on.”
Answer: The metadata for the controlled file is stored in it's parent element. So you must
check out the parent element in order to change any associated information, such as the
description, properties, and so on.
For instance, in the example provided in Creating a controlled file,
right-clicking on the parent element RailCarsPackage and choosing Configuration
ManagementCheck out, allows the controlled file attributes to be modified.
Question: “I know controlled files are copied to a directory under _rpy during the creation
of the controlled file, but where exactly is the controlled file copied?”
Answer: Controlled Files are copied to the same location where its parent is located on
the disk. For instance, suppose you have a package called “package_1” and the repository
file for it is stored like this: MyProject_rpy\package_1\package_1.sbs.
Now any controlled file you add to the package “package_1” is going to be stored in the
folder: MyProject_rpy\package_1\
Question: “When I open a Controlled File Features window and try to rename the
Controlled File, I receive the ‘File not found’ error.”
Answer: You have the ability to select different files from an opened Features window. So
when you type a different name, the system “thinks” that you are actually trying to point
to a different file and returns an error message.
You can rename a controlled file from the browser by clicking two separate times on it
(double-clicking on the file will open it).
Question: “Is it possible to add a Controlled File to the model without copying the file to
the _rpy folder?”
Answer: No, but you can add a hyperlink to the wanted file instead. However, this will
result in the loss of all CM (Configuration Management) capability which includes the
following operations:
– Add to archive
– Check in
– Check out
– Lock
– Unlock
Workaround: Create a new package under the project. By default, a package is stored in
separate file: do not modify that setting. Now add the problematic controlled files to this
package. Now you will be able to perform CM operations.
Issue: Adding an existing element with a Controlled File to the Model and choosing a
different name, instead of replacing the file.
Details: If you perform an Add To Model of an already existing element, Rational
Rhapsody gives you the option of replacing the element or adding it using a different
name. If you choose to use a different name, Rational Rhapsody adds the element using
the new name.
If both the element that already existed in the model and the element that was just added
have controlled files by the same name, more than one controlled file of the same name
exists in the model. But there might be only one instance of the file in the directory, which
means the two controlled files in the model are actually pointing to the same file.
If you are trying to “Connect to Archive” using the Configuration Items tool (File/
Configuration Items), and your Rational Rhapsody project contains a controlled file, the
following error results:
Reason: Rational Rhapsody could not add “Project_rpy” to Source Control as the project
contains at least one Controlled File. To proceed, add this directory (and its
subdirectories) to Source Control using Rational ClearCase. Note that, you do not need to
Connect to Archive again.
Use Rational ClearCase to add the directory to the appropriate source control. You now
do not have to perform a “Connect to Archive.”
Deleting an Element with a Controlled Files Deletes the Controlled File From the
Model Only.
If you delete a controlled file from a Rational Rhapsody Model, you are given the option
to either delete the file completely from the hard disk drive or leave the file intact and
simply delete the controlled file from the model. If you delete any other element that
includes a controlled file (as a child), the controlled file is left intact on the hard disk; the
option to delete the controlled file completely from the hard disk drive is not offered.
Moving a Controlled File - Browser vs. Graphic Editor
If you have two packages stored in different directories (P1 and P2 for this example), and
you add a controlled file to the P1 directory, the physical controlled file on the hard disk is
stored in P1's directory (the same directory where P1.sbs file is located).
From the Rational Rhapsody browser, drag the controlled file from P1 and drop it in the
P2 package. Now examine the contents of the P1 and P2 directories on the hard disk.
Notice that the file has moved from the P1 directory to the P2 directory.
If you repeat the above exercise in the Rational Rhapsody Graphic Editor, the physical
file is copied from the old directory to the new directory, instead of being completely
moved from the old directory to the new directory.
Configuration Management Synchronize window Does Not Show Controlled Files
The Configuration Management window shows the version number for the items in its
listing (only in command mode). But for a controlled file, it does not show the version
number.
Foreign Language Controlled File Names are Not Supported
If your file name has non-English characters, you cannot add it to your project as a
controlled file.
CM Archive is Not Affected When Controlled Files are Moved/Renamed/Deleted
When you move, rename or delete a Controlled File, its respective Configuration
Management item is not updated accordingly.
DiffMerge limitations
Diffmerge Does Not Compare the Contents of Two Controlled Files
Diffmerge does not identify/indicate any content differences between two controlled files.
Diffmerge does not examine the contents of controlled files as they exist on the hard disk
drive. However, Diffmerge can show differences between the metadata information of
two controlled files in the model.
Ex. Given two packages (Pkg1 and Pkg2) that each contain the controlled file readme.txt,
if the file contents of the Pkg1 readme.txt are different from the contents of the Pkg2
readme.txt then a Diffmerge performed between Pkg1 and Pkg2 will not identify that the
readme.txt files are different. However, if the Pkg1 readme.txt and Pkg2 readme.txt have
different metadata such as properties or description then those differences are shown in
the Diffmerge.
'Save merge as…' or 'merge back to rhapsody' Does Not Save Any Controlled Files
When using Diffmerge to compare two model units that contain controlled files,
performing the “Save merge as...” or “merge back to rhapsody” functions does not save
the controlled files on the hard disk drive.
Ex. Using the same example as above, if you compare Pkg1 with Pkg2 and save the
merge as “Pkg_Merged,” the physical file readme.txt for Pkg_Merged will not be saved
on the physical hard disk drive. If you were to navigate to the file under the appropriate
directory (c:\diffmerge for example), you would notice the readme.txt file does not appear
in that directory.
Print Diagrams displays all the diagrams used in the model so you can easily select
which ones to print (see Selecting which diagrams to print)
Print displays the standard Print window, which enables you to print the current diagram
on the specified printer
Print Preview displays a preview of how the diagram will look when it is printed
Printer Setup displays the standard Print Setup window, which enables you to change the
printer settings, such as landscape instead of portrait mode
Diagram Print Settings enables you to specify diagram-specific print options (see
Diagram print settings)
1. Choose File > Print Diagrams. The Print Diagrams window opens, listing the diagrams
and statecharts in the current project. The window has the following features:
The list box on the left shows all of the diagrams in the project.
The list box on the right shows the names and types (for example,
ObjectModelDiagram) of the diagrams selected for printing.
The buttons in the middle let you select and deselect diagrams for printing.
The Up/Down arrows on the far right control the order in which the diagrams are
printed.
The buttons along the bottom edge of the window access the Print window, or
cancel printing.
2. To expand the list of diagrams in the project, click the + sign to the left of one of the
diagram type names. The tree expands to show all the diagrams of that type. Note that
statecharts are listed first by package, then by class.
a. To add a diagram to the print list, select it in the list on the left and click Add.
b. To add all the diagrams in the project to the print list, click Add All.
c. To remove a diagram from the print list, select it in the list on the right and click
Remove. Rational Rhapsody prints the diagrams listed in the right from top to
bottom.
d. To change the print order, select a diagram from the print list and use the up or down
arrows.
a. Print dismisses the Print Diagrams window and opens the standard Print window for
your operating system. In this window, you set attributes such as page size (for
example, 11” x 17”), the printer to use, whether to print to a file, whether to use
grayscale, and initiate the printing operation.
By default, the header includes the name of the diagram, and the footer
contains the page number. To specify a new header or footer, uncheck the
appropriate check box and type the new value in the text box.
For example, to include the name of your company in the diagram header:
3. Click OK.
To scale the diagram so it fits on a single page, right-click in the diagram and select Printing > Fit
on One Page. To break the diagram across pages, simply disable this option.
Click the Toggle Page Breaks tool to toggle the display of page breaks in your diagram.
Select Layout > View Page Breaks.
Right-click in the diagram and select Printing > View Page Breaks. The dashed lines that
represent the page boundaries are displayed.
2. Right-click inside the diagram, but not on a specific item in the diagram.
4. In the Save As window, select a directory for the saved image in the Save in directory
selection field.
5. In the File name field, type the name you want to use for the exported image file.
Note
None of the annotation types generate code; they are used to improve the readability and
comprehension of your model.
Constraint for a condition or restriction expressed in text. It is generally a Boolean
expression that must be true for an associated model element for the model to be
considered well-formed. A constraint is an assertion rather than an executable
mechanism. It indicates a restriction that must be enforced by the correct design of a
system.
Constraints are part of the model and are, therefore, displayed in the browser.
Comment for a textual annotation that does not add semantics, but contains information
that might be useful to the reader and is displayed in the browser.
Note for a textual annotation that does not add semantics, but contains information that
might be useful to the reader. Notes are not displayed in the browser.
Requirement for a textual annotation that describes the intent of the element. Note that a
requirement modeled inside Rational Rhapsody does not replace the usage of a dedicated
requirement traceability tool, such as DOORS. Instead, a modeled requirement
complements the usage of such a tool because the hierarchical modeling of requirements
enables you to easily correlate each requirement to the element that addresses it.
Requirements are part of the model and are therefore displayed in the browser.
Creating annotations
To add an annotation to a diagram:
1. Click the appropriate icon in the Diagram Tools for the type of annotation you want to
create.
The same annotation can apply to more than one model element and multiple annotations can
apply to the same model element. You can use “ownership” instead of an anchor. For example, if a
requirement is owned by a class, it is a requirement of the class.
The new annotation is displayed in the diagram, and in the browser if it is a modeled annotation.
Note that documentation notes and text are graphical annotations and exist only in the diagram; all
the other Rational Rhapsody annotations are modeled annotations, and are part of the model itself.
Because modeled annotations are part of the model, they can be viewed in the browser. In addition,
you can move modeled annotations to new owners using the browser, and can drag-and-drop them
from the browser into diagrams. Modeled annotations are displayed under separate categories in
the browser by type.
2. Select Add New > Annotations > Constraint, Comment, or Controlled File. The new
annotation is added under the selected element.
An annotation created using the browser does not anchor the annotation to the specified model
element. However, you can organize annotations so that anchoring is implied.
3. Click the edge of the annotation on which the first annotation depends.
1. In the browser, right-click the component that will own the requirement and select Add
New > Requirement.
Name specifies the name of the constraint. To enter a detailed description of the
constraint, click the Description tab.
L specifies the label for the element, if any. For information on creating labels, see
Descriptive labels for elements.
Stereotype specifies the stereotype of the constraint, if any. They are enclosed in
guillemets, for example «s1» and enable you to tag classes for documentation purposes.
For information on creating stereotypes, see Stereotypes.
– To select from a list of current stereotypes in the project, click the folder with
binoculars button.
– To sort the order of the stereotypes, click the up and down arrows button.
Note: The COM stereotypes are constructive; that is, they affect code generation.
Type specifies the annotation type. For example, you could use this field to easily change
a constraint to a requirement or comment.
Defined in (read-only field) specifies the owning class of the annotation.
Specification specifies the note text or constraint expression.
Anchored Elements lists all the elements that are anchored to this annotation.
To convert a note to a comment (to be displayed in the browser), in the diagram, right-click the
note and the select Convert to Comment.
Anchoring annotations
You can anchor a constraint, comment, requirement, or note to one or more graphical objects that
represent modeling concepts (classes, use cases, and so on). You can also anchor annotations to
edge elements.
3. Move the cursor to the edge of the model element to which you want to anchor the
annotation, then click to confirm.
To change the line style of an anchor, right-click the anchor line and select the appropriate option
from the Line Shape menu.
There should be only one anchor between a specific annotation and a given model
element.
An annotation can be anchored to more than one element.
2. Select References from the menu. The References window lists all the references for the
specified class. Anchored annotations are labeled “Anchor” in the Type column.
Deleting an anchor
To delete an anchor:
The Display Options window for the selected annotation type opens, with only the relevant fields
displayed. All of the fields are as follows:
The following figure shows some of the different display options. The annotation types and
display options are as follows:
Comment, displayed with its specification label using the pushpin style
Requirement, displayed using its label
Documentation note
Constraint
Text note
Deleting an annotation
To delete an annotation, on the browser, right-click the annotation to be deleted and select Delete
from Model.
To delete an annotation from a diagram, right-click the note and do one of the following actions:
Tool Description
COM API Annotations are supported by the COM API via the following interfaces:
• IRPAnnotation
• IRPComment
• IRPConstraint
• IRPRequirement
Complete Relation When you select Layout > Complete Relations, anchors are part of the information
added to the diagram.
DiffMerge Annotations are included in difference and merge operations.
Populate Diagram Annotations and anchors are not supported.
References If you use the References functionality for a modeled annotation, the tool lists the
diagrams in which the specified annotation displays. When you select a diagram from the
returned list, the annotation is highlighted in the diagram.
If you use the References functionality for an element, the tool includes any annotations
that are anchored to the specified element
For more information on this functionality, see Searching in the model.
Report on model Modeled annotations are listed by type under the owning package. Graphical annotations
are not included in the list.
Rational Rose Notes in Rational Rose (which are not displayed in the browser) are imported as notes in
Rational RhapsodyAnnotations.
Search in model When you search in a model, the search includes modeled annotations, including
the Body section. When selected, the annotation is highlighted in the browser.
For more information on this functionality, see Searching in the model.
Annotation limitations
Note the following limitations for annotations:
Profiles
A profile is a special kind of package that is distinguished from other packages in the browser. You
specify a profile at the top level of the model. Therefore, a profile is owned by the project and
affects the entire model. By default, all profiles apply to all packages available in the workspace,
so their tags and stereotypes are available everywhere. A profile is very similar to any other
package; however, profiles cannot be nested.
A profile “hosts” domain-specific tags and stereotypes. Tags enable you to add information to
certain kinds of elements to reflect characteristics of the specific domain or platform for the
modeled system. Tags are easily viewable in their own category in the browser and in the Tags tab
of the Features window for an element.
You can apply tags to certain cases by associating the tag definition to stereotypes in a profile or a
package. In this case, the tags are visible only for those model elements that have the specified
stereotype. In addition, you can apply tags to individual elements.
The browser displays all of the profiles used in a project together, as shown in this example:
This example lists two profiles. MessageProfile is a user-defined (customized) profile. For more
information about these profiles, see Creating a customized profile. SPT was automatically added
to the project because the developer specifies the Scheduling, Performance, and Time method to
add timing analysis data. For more information, see Types of profiles.
1. Create the new project by either selecting File > New, or click the New project icon in the
main toolbar.
2. Replace the default project name (Project) with <your project name> in the Project
name field. Enter a new directory name in the In folder field or Browse to find an
existing directory.
3. Select Default for the Project Type and Project Settings.
4. Click OK.
The basic structure for your new project is displayed in the browser with no Profiles folder.
If you have a project that was created in an older version of Rational Rhapsody and you begin to
work on it in a newer version, Rational Rhapsody automatically inserts the required settings to
manage any compatibility issues.
Pre60GESkin uses the colors and fonts from versions before Rational Rhapsody 6.0.
CGCompatibilityPre61C makes the code generation backwards compatible with pre-6.1
Rational Rhapsody in C models.
CGCompatibilityPre61Cpp makes the code generation backwards compatible with
pre-6.1 Rational Rhapsody in C++ models.
CGCompatibilityPre61Java makes the code generation backwards compatible with
pre-6.1 Rational Rhapsody in Java models.
CGCompatibilityPre61M1C makes the code generation backwards compatible with
pre-6.1 maintenance release 1 Rational Rhapsody in C models.
CGCompatibilityPre61M1Cpp makes the code generation backwards compatible with
pre-6.1 maintenance release 1 Rational Rhapsody in C++ models.
CGCompatibilityPre70C makes the code generation backwards compatible with pr-7.0
Rational Rhapsody in C models.
CGCompatibilityPre70Cpp makes the code generation backwards compatible with
pre-7.0 Rational Rhapsody in C++ models.
CGCompatibilityPre70Java makes the code generation backwards compatible with
pre-7.0 Rational Rhapsody in Java models.
CGCompatibilityPre71C makes the code generation backwards compatible with pre-7.1
Rational Rhapsody in C models.
CGCompatibilityPre71Cpp makes the code generation backwards compatible with
pre-7.1 Rational Rhapsody in C++ models.
CGCompatibilityPre71Java makes the code generation backwards compatible with
pre-7.1 Rational Rhapsody in Java models.
CGCompatibilityPre72C makes the code generation backwards compatible with pre-7.2
Rational Rhapsody in C models.
CGCompatibilityPre72Cpp makes the code generation backwards compatible with
pre-7.2 Rational Rhapsody in C++ models.
CGCompatibilityPre72Java makes the code generation backwards compatible with
pre-7.2 Rational Rhapsody in Java models.
Types of profiles
Rational Rhapsody provides the following types of profiles:
Rational Rhapsody predefined Profiles, such as AutomotiveC and DoDAF, can be selected
from the New Project window when creating a new project or added to a project later, as
described in Adding a Rational Rhapsody profile manually.
User-defined profiles, as described in Creating a customized profile.
Add On product profiles, which require an additional license, are automatically added
when the engineer uses the associated add-on product, or it can be added using File >
Add Profile to Model.
Profile properties
By default, all profiles apply to all packages available in the workspace. To associate existing
profiles with new Rational Rhapsodyannotation models, use the following properties (under
General::Profile):
You can use profiles like any other package, including exchanging them between users and using
configuration management tools with them.
As referred to by Rational Rhapsody, a custom help file consists of a help file and a map file, both
of which you must create. There might be times when you have a project for which you would like
to access your own help file. This might be particularly useful when there is a team working on the
same project and you want them to share the same specific information. For example, your
company might create its own help file to document its project terminology and project/corporate
standards.
To enable the ability to access your custom help file from within Rational Rhapsody, you have to
set properties to identify and locate your custom help file and map file. Then for an element
associated with the New Term stereotype in the Rational Rhapsody profile for your Rational
Rhapsody project, when a user presses F1 to call a help topic, your custom help file would open
instead of the main Rational Rhapsody help file.
Keep in mind that the Rational Rhapsody product provides you with an extensive help file that
always displays when there is no custom help file available.
Note
IBM is not responsible for the content of any custom help file and map file.
The creation, functioning, testing, and maintenance of a custom help file and map file are
the responsibilities of the creators of these files.
If you plan to share the custom help file with team members, place it in a shared location on a
network. You identify this file and its location in the Model::Stereotype::CustomHelpURL
property, as detailed in Enabling access to your custom help file.
1. Add the following line to the [General] section of the rhapsody.ini file and save your
changes:
ShowActiveWindowHelpID=TRUE
This means that now when you press F1 to open the Rational Rhapsody help file, you will
see a window with a resource ID instead, as shown in the next step.
2. In Rational Rhapsody, press F1 for a GUID element that you plan to associate with a New
Term stereotype (for example, if your New Term stereotype is applicable to a class, the
Attributes tab of the Features window).
3. Add the resource ID number to your help map file. Each number must be on its own line.
The following figure shows the contents of a map file called myhelp.map. (Another
example of a help map file name: myhelp.txt.)
Note: For testing purposes as mentioned in Enabling access to your custom help file,
include the resource IDs shown in the following figure in your map file. You
can delete these IDs later.
Note: You might find it useful to add the name of the element next to the resource ID
number (for example, 161328 Attributes tab).
4. If you plan to share the custom help file with team members, place the help map file in a
shared location on a network. You identify this file and its location in the
Model::Stereotype::CustomHelpMapFile property, as detailed in Enabling access to
your custom help file.
Note: When your map file is complete, to ensure that help topics appear instead of
resource ID numbers when you press F1, you can comment out the
ShowActiveWindowHelpID=TRUE line in the rhapsody.ini file (for example,
insert a semicolon or pound sign in front of the line) or you can delete the line.
If for a particular resource ID (for example, the Tags tab of the Features window) you want your
custom help file to open to a specific spot in the custom help file, add a bookmark to that spot in
the help file. Use the standard HTML <a name> and </a> tags.
For example, the myhelp.htm help file has three sections labeled: Attributes, Ports, and Tags.
When you open the help file, you see the Attributes section first. If for the Tags tab, which is
resource ID 139316, you want to open the custom help file at the Tags section of the help file, you
would code it as follows in the myhelp.htm help file:
<a name=“139316”>Tags</a>
Then when you press F1 on the Tags tab, the custom help file opens at the Tags section of the help
file.
Note
These instructions assume you have created your custom help file and your map file. See
About creating your custom help file and Creating your map file.
1. For the profile or its stereotype for the Rational Rhapsody project on which you want to
provide custom help, set the Model::Stereotype::CustomHelpURL and
CustomHelpMapFile properties as follows:
a. Open the Features window for the profile or its New Term stereotype. On the Rational
Rhapsody browser, double-click the profile name or stereotype name (for example,
profile Auto2009 or stereotype Stereotype_Auto2009).
b. On the Properties tab, select All from the View drop-down arrow (the label changes
to View All).
Note: You can specify an environment variable as part of the URL (for example,
$DODAF_HLP_ROOT\dodaf_help.map).
e. Click OK.
2. Create an element using the New Term stereotype. Right-click a package in your project
and select Add New > Auto2009 >Stereotype_Auto2009. Notice that these choices are
located at the bottom of the pop-up menu.
If the help file is to be accessed over a network, make sure it is accessible. You might want
to have someone else (besides the person who set it up) try to access the custom help file
from within Rational Rhapsody over the network before rolling out the feature to the rest
of your project team.
If you have set it so that your custom help opens at specific spots in the help file for
specific resource IDs, be sure to check these particular links. See Bookmarking your
custom help file for a specific resource ID.
If yes, Rational Rhapsody searches for the resource ID in your help map file and it opens
the custom help file.
If no, Rational Rhapsody opens its main help file.
Note
The GUI element must be applicable to the New Term stereotype for the Rational Rhapsody
profile for your custom help file to work.
For example, if the Auto2009 profile has a New Term stereotype called
Stereotype_Auto2009 and you add an element with this stereotype to a package called
Default, when you open the Features window for one of these stereotypes (for example,
stereotype_auto2009_0) and then you press F1, your custom help should open (assuming
you added the resource IDs for the tabs on this window to your help map file).
However, when you open the Features window for the package and you press F1, you open
the main Rational Rhapsody help file because this package is not associated with the New
Term stereotype call Stereotype_Auto2009.
Stereotypes
Defined stereotypes are displayed in the browser. Stereotypes can be owned by both packages and
profiles.
To define a stereotype:
1. In the Rational Rhapsody browser, right-click the profile or package that owns the
stereotype and then select Add New > Stereotype. Rational Rhapsody creates a new
stereotype called stereotype_n under the Stereotypes category.
5. For profiles, if you are working in a domain with specialized terminology and notation,
select the New Term check box to create a new metaclass. Since a term is based on an
out-of-box metaclass, it functions in the same manner as its base metaclass. For more
information about new terms, see Special stereotypes.
6. Click OK.
7. Optionally, to set the formatting for the stereotype, right-click the new stereotype name in
the browser and select Format. Use the Format window to define the visual
characteristics for the stereotype.
Alternatively, you can select the stereotypes from a tree display, as follows:
3. Find the stereotypes you would like to apply. Use Ctrl and Shift to select more than one
stereotype.
1. Click the Change Stereotype Order button , or right-click the stereotype list when it is
closed and select Edit Order.
2. When the list of selected stereotypes is displayed, use the up and down arrows to reorder
the list.
3. Click OK.
3. Rename an existing .bmp file (or add a new file) in the PredefinedPictures directory so
it has the same name as the stereotype.
6. Under Show stereotype, select Icon; change Display name to Name only.
To change the bitmap background to transparent (so only the graphic itself is visible), set the
property General::Graphics::StereotypeBitmapTransparentColor to the RGB value of the
bitmap background.
Deleting stereotypes
1. Select the stereotype to delete.
2. Click the Delete button.
3. Click OK.
The derived stereotype inherits the following characteristics from its base stereotype:
You can add tags to the derived stereotype, and add elements to the list of elements to which it can
be applied.
To establish stereotype inheritance, in the browser, right-click the stereotype that will be the
derived stereotype and select Add New > Super Stereotype
These steps can be repeated in order to create a stereotype that inherits from a number of other
stereotypes.
Special stereotypes
If a stereotype inherits from one of the “special” stereotypes, for example, usage or singleton, it
inherits the special meaning of the base stereotype.
If a stereotype inherits from a “new term” stereotype, then it is also a “new term” stereotype.
However, the “new term” status of the derived stereotype is removed if you do something that
contradicts this status, for example, using multiple inheritance such that the derived stereotype
ends up being applicable to more than one type of element.
1. Create the profile to hold the tag if it does not already exist (see Creating a customized
profile).
2. If it does not already exist, define a stereotype for the profile and select <<New>> (see
Stereotypes). The Features window opens.
4. The Quick Add fields let you define the name for the tag and its default value quickly and
click Add.
5. You might want to enter a more detailed description of the tag in the area above the Quick
Add.
6. Click OK.
The new tag is added to the Tags tab. In addition, it is added to the browser.
Note
To create a new tag using the browser, right-click the stereotype and select Add New > Tag.
You can rename the tag if you want.
For example, you could create a new tag to specify prerequisite attributes for all primitive
operations in the project by selecting the Primitive Operation element from the Applicable to
list. This tag will be included automatically in the Tags tab of any primitive operation in the
project as <ProfileName>::<ElementType::<TagName>.
Deleting a tag
You can use the Rational Rhapsody browser or the Features window to delete a tag Select.
1. Right-click the tag on the browser and select Delete from Model.
2. Click Yes to confirm your requested action.
1. Open the Features window for the element to which the tag belongs and select the Tags
tab.
2. Select the tag you want to delete and click the Delete button in the upper-right corner
of the tab.
Note
If you delete a tag definition in a stereotype, it is removed from the list of tags. However, if
the value for the tag has been overridden, that tag will not be removed.
When you choose to edit code, Rational Rhapsody launches the internal code editor. This editor
has a wide range of features to assist with editing.
Unlike external editors, the Rational Rhapsody internal code editor provides dynamic model-code
associativity (DMCA). The DMCA feature of Rational Rhapsody enables you to edit code and
automatically roundtrip your changes back into the model. It also generates code if the model has
changed. If you use an external editor, DMCA will no longer be available.
Window properties
The Window Properties window enables you to customize the Rational Rhapsody internal code
editor window. Note that these window properties are completely separate from Rational
Rhapsody project properties. To open the window, right-click anywhere within the editor window
and select Properties.
Alternatively, press Alt+Enter on the keyboard. You can customize this shortcut using the
Keyboard tab on the Window Properties window. The window contains the following tabs:
Color/Font
Language/Tabs
Keyboard
Misc
The following sections describe how to use these tabs in detail.
In addition to the default keywords (such as class and public), you can specify the additional
language-specific keywords to be color-coded by the Rational Rhapsody internal code editor by
4. Choose a highlighting color by selecting it in the Background list. Note that background
highlighting is unavailable for all elements.
1. In the Font area of the Color/Font tab, click Change. The Font window opens, as shown
in the following figure.
2. As wanted, select new values for the Font, Font style, and Size fields. You can view the
effects of your changes in the Sample field.
3. Click OK twice.
Auto indentation style specifies whether lines are automatically indented according to
either the language scope or to the previous line in the file.
Note: Changes to tab size do not affect existing tab spacing. The new size applies to
tabs entered after the change is made.
Language specifies your programming language.
If you want any case errors corrected automatically for you, select the Fixup text case
while typing language keyword check box. For example, if this option is selected and
you typed “WHile” as the keyword, the internal code editor automatically corrects the
case of the keyword to read “while.”
The edit commands are started using keyboard shortcut keys. Mapping edit commands to easy-to-
use and easy-to-remember keyboard shortcuts reduces the time and difficulty of editing text. Most
commands have been mapped to a default shortcut. You can modify all shortcuts from the
Keyboard tab of the Window Properties window.
1. On the Keyboard tab, select an edit command from the Command list.
3. Use the keyboard to type the shortcut key sequence. If you make a mistake, click Reset
and type the sequence again.
4. Click OK.
Command Keystroke
BookmarkNext F2
BookmarkPrev Shift + F2
BookmarkToggle Ctrl + F2
CharLeft Left
CharLeftExtend Shift + Left
CharRight Right
CharRightExtend Shift + Right
Copy Ctrl + C
Copy Ctrl + Insert
Cut Shift + Delete
Cut Ctrl + X
CutSelection Ctrl + Alt + W
Delete Delete
DeleteBack Backspace
Command Keystroke
DocumentEnd Ctrl + End
DocumentEndExtend Ctrl + Shift + End
DocumentStart Ctrl + Home
DocumentStartExtend Ctrl + Shift + Home
Find Alt + F3
Find Ctrl + F
FindNext F3
FindNextWord Ctrl + F3
FindPrev Shift + F3
FindPrevWord Ctrl + Shift + F3
FindReplace Ctrl + Alt + F3
GoToLine Ctrl + G
GoToMatchBrace Ctrl + ]
Home Home
HomeExtend Shift + Home
IndentSelection Tab
LineCut Ctrl + Y
LineDown Down
LineDownExtend Shift + Down
LineEnd End
LineEndExtend Shift + End
LineOpenAbove Ctrl + Shift + N
LineUp Up
LineUpExtend Shift + Up
LowercaseSelection Ctrl + U
PageDown Next
PageDownExtend Shift + Next
PageUp PRIOR
PageUpExtend Shift + Prior
Command Keystroke
Paste Ctrl + V
Paste Shift + Insert
Properties Alt + Enter
RecordMacro Ctrl + Shift + R
Redo Ctrl + A
SelectLine Ctrl + Alt + F8
SelectSwapAnchor Ctrl + Shift + X
SentenceCut Ctrl + Alt + K
SentenceLeft Ctrl + Alt + Left
SentenceRight Ctrl + Alt + Right
SetRepeatCount Ctrl + R
TabifySelection Ctrl + Shift + T
ToggleOvertype Insert
ToggleWhitespaceDisplay Ctrl + Alt + T
Undo Ctrl + Z
Undo Alt + Backspace
UnindentSelection Shift + Tab
UntabifySelection Ctrl + Shift + Space
UppercaseSelection Ctrl + Shift + U
WindowScrollDown Ctrl + Up
WindowScrollLeft Ctrl + Page Up
WindowScrollRight Ctrl + Page Down
WindowScrollUp Ctrl + Down
WordDeleteToEnd Ctrl + Delete
WordDeleteToStart Ctrl + Backspace
WordLeft Ctrl + Left
WordLeftExtend Ctrl + Shift + Left
WordRight Ctrl + Right
WordRightExtend Ctrl + Shift + Right
The following sections describe how to use some of the more interesting features available on the
Misc tab.
To allow splitting of the screen into two horizontal panes, check the Allow Horizontal Splitting
box on the Misc tab. To allow splitting of the screen into two vertical panes, check the Allow
Vertical Splitting box.
1. Click the horizontal splitter at the left end of the horizontal scroll bar (see the figure).
2. While holding down the mouse button, drag the splitter to the right until the new pane
displays.
1. Click the vertical splitter at the top of the vertical scroll bar.
2. While holding down the mouse button, drag the splitter downward until the new pane
displays.
Vertical splitter
Horizontal splitter
Mouse actions
Use the mouse to select and edit text in the editor window. The following table lists the available
mouse actions.
You can set the maximum number of undo operations from the Window Properties window; the
default is to allow an unlimited number of undo operations.
1. On the Misc tab, in the Maximum Undoable Actions section, select Limited to.
2. In the adjacent box, type the maximum number of undo actions you want to allow.
3. Click OK.
Match whole word only finds instances where the search term is the whole word.
Match case finds matching instances that have the same case as the search term.
Direction choose Up to search text above the cursor position, or Down to search
text below the cursor position.
4. Click Find to find the next instance of the search term or click Mark All to place a
bookmark in the left margin next to all instances matching the search term.
Bookmarks
The bookmark feature places a blue triangular marker in the left margin to identify a line of text.
To place a bookmark in the margin, use the BookmarkToggle edit command. The default shortcut
for BookmarkToggle is Ctrl+F2.
1. Make sure that the editor window containing the file you want to print is the active
window in Rational Rhapsody.
2. From the Rational Rhapsody File menu, select Print.
3. In the Print window, select the printing options, then click Print.
The Rational Rhapsody graphic editors for the different UML diagrams provide the tools needed to
create different views of a software model. Each graphic editor is described in detail in subsequent
sections of this guide. This section describes the menus and features that are common to all the
graphic editor.
To create a new statechart, right-click a class in the Rational Rhapsody browser and select Add
New > Diagrams > Statechart. A new (blank) diagram is displayed in the drawing area.
Note
Add New > Diagrams is the default menu command structure in Rational Rhapsody. It can
be changed by users. This topic assumes that all defaults are in place.
To create a new activity diagram, right-click a class in the Rational Rhapsody browser and select
Add New > Diagrams > Activity. A new (blank) diagram is displayed in the drawing area.
Note
Add New > Diagrams is the default menu command structure in Rational Rhapsody. It can
be changed by users. This topic assumes that all defaults are in place.
1. Select the appropriate diagram type from Tools > Diagrams or click the appropriate
button on the Diagrams toolbar:
2. From the Open Diagram window, select the project or a package where you would like to
add the diagram.
a. Populate Diagram, which automatically populates the diagram with existing model
elements. This option applies to object model, use case, and structure diagrams. For
more information, see Automatically populating a diagram.
b. Operation Mode specifies whether to create an analysis SD, which enables you to
draw message sequences without adding classes and operations to the model; or a
design SD, in which every message you create or rename is realized to an operation
in the static model. For more information, see Sequence diagrams.
6. Click OK. A new (blank) diagram is displayed in the drawing area.
1. Click the appropriate button in the Diagrams toolbar to open the Open <Diagram Name>
window.
2. Depending on the type of diagram you want to open:
For statecharts and activity diagrams, select the diagram you want to open and
click OK.
For all other diagrams, select the diagram (if there are any) you want to open and
click Open.
As with other Rational Rhapsody elements, the Features window for the diagram enables you to
edit its features, including the name, stereotype, and description. For more information, see The
Features window.
In addition, you can go to a currently opened diagram by selecting it from the last section of the
Windows menu.
In addition, you can go to a currently opened diagram by selecting it from the last section of the
Windows menu.
Deleting diagrams
In most cases, you can delete existing UML diagrams only from the Rational Rhapsody browser.
However, you can delete statecharts and activity diagrams from both the browser and from the
Tools menu.
2. Right-click and select Delete from Model, or press the Delete key.
Hierarchical
The elements are organized according to levels of inheritance, with lower levels inheriting
from upper levels. Each layer is organized to minimize the crossing and bending of
inheritance arrows and is individually centered in the diagram. You can choose this style
for any type of relation. If there are no classes or inheritance, the elements might appear
organized as layers, depending on the direction of the populated diagrams.
Orthogonal
The entire drawing is made as compact as possible. Classes are placed to minimize the
intersection, length, and bending of relation arrows. You can use this style for any
relation, including inheritance relations.
1. In the browser, right-click an existing use case, object model, or structure diagram
category where you want to create another of the same diagram and select Add New
<element type> (for example, Add New Object Model Diagram) to open the New
Diagram window.
3. Select the Populate Diagram check box and click OK to open the Populate Diagram
window.
4. In the Create Contents Of Diagram Using group, indicate how you would like Rational
Rhapsody to create the contents of the diagram:
Relations Among Selected populates the diagram only with the selected elements
and the relations between them
Relations From/To Selected populates the diagram with the selected elements,
their incoming and outgoing relations, and the model elements that complete
these relations
Relations From Selected populates the diagram with the selected elements, their
outgoing relations, and the model elements that complete the relations
Relations To Selected populates the diagram with the selected elements, their
incoming relations, and the model elements that complete the relations
5. In the Types Of Relations To Be Used group, select which types of relations you would
like Rational Rhapsody to use when creating the contents of the diagram:
7. In the Preferred Layout Style group, select the type of layout you would like Rational
Rhapsody to use when creating the diagram. If you select None, Rational Rhapsody
automatically chooses the best layout style according to the type of relations you have
chosen to display.
8. Click OK. The new diagram displays in the drawing area with all of the selected elements
added. You can then begin to add information to the new diagram.
Note
When auto-populating a diagram, if you want Rational Rhapsody to populate each class so
it shows its attributes and operations, set the ObjectModelGE::Class::ShowAttributes
and ObjectModelGE::Class::ShowOperations properties to All in the scope of the
package or project.
Right-click a blank spot on the diagram in its drawing area and select Populate or choose
Layout > Populate.
Right-click the diagram on the Rational Rhapsody browser and select Populate.
See the details for the Populate Diagram window in Creating and populating a new diagram.
Note
Rational Rhapsody does not change the location of already existing elements. it just adds
the new elements.
Property Description
Property Description
For detailed information on how the General::Graphics properties affect the drawing of your
model, see the definitions displayed in the Properties tab of the Features window.
1. Right-click in the diagram window and then select Diagram Fill Color.
2. Select a color.
Create elements
The diagram editors enable you to create a number of elements to enhance your model. To create
any kind of element, you must first select one of the drawing tools on it diagram editor toolbar.
When Rational Rhapsody is in drawing mode, the cursor includes a tooltip showing an icon of that
element. For example, the following cursor is displayed when you are drawing a class.
The items you can draw in the diagram editors fall into two main categories: boxes and lines. In
addition, Rational Rhapsody enables you to create freestyle shapes. The following sections
describe how to create these elements.
In some cases, however, you might want to add a number of elements of the same type. To
facilitate this, Rational Rhapsody includes a repetitive drawing mode.
To enter repetitive drawing mode, click the “stamp” icon in the Layout toolbar. Now, after
choosing a tool in the Diagram Tools, you will be able to continue drawing elements of that type
without selecting the tool again each time. If you choose a different tool from the toolbar, then
Rational Rhapsody will allow you to draw multiple elements of the newly selected type.
After you click the icon, Rational Rhapsody remains in repetitive drawing mode until you turn it
off. To turn off the repetitive mode, just click the "stamp" icon a second time.
Drawing boxes
Each editor contains tools to draw boxes. The following table lists the box elements available with
each editor.
To draw a box:
2. Move the cursor to the drawing area, and do one of the following actions:
a. Quick-Draw where you can click once to draw a box with the default size, shape, and
name.
b. Drag where to draw classes, simple classes, and packages, you click-and-drag to the
opposite corner and release. If you hold down the Shift key, you create a square box.
Note that the cursor changes to the icon of whatever you are drawing (class, object,
package, and so on).
3. When you complete the box, the element is given a default name. To rename it, click the
text to enable editing. Type the new name, then press Enter or click outside the box.
4. Click anywhere outside the box to start a new box, or click the Select tool to stop creating
boxes.
To add an existing box element to a diagram, you can simply drag-and-drop the element from the
browser to the drawing area.
Drawing arrows
Arrows connect boxes, representing the connections between different boxes in the diagram. For
example, associations and dependencies are two types of arrows that can be drawn in use case
diagrams.
Drag where you click inside the source box, drag, and release the mouse inside the
destination box.
Simple arrow clicks where you click inside the source box and click the border of the
destination box.
Multiple clicks where you click inside the source box, click any number of times to mark
the control points on the path of the arrow, and double-click inside the destination box.
You cannot add control points to a message arrow because it allows only two clicks.
Another point displays immediately to show where the next arrow will start.
Note that the cursor changes when you create arrows:
If you click a valid element for the destination of the arrow (for example, you are drawing
a activity flow and you click a class), the cursor changes to crosshairs in a small circle.
If you try to connect an arrow to an invalid element, Rational Rhapsody displays a “no
entry” symbol to show that you cannot connect the arrow to that element, as shown in the
following figure.
The Edit menu contains the Line Shape option, which specifies your preferred line shape for the
specified arrow. You can also access the Line Shape option by right-clicking an arrow or line in a
diagram.
Note
You can use the line_style property to change the line shape (straight, spline, rectilinear)
for a line type (for example, Link, Dependency, Activity Flow, Generalization) for a
diagram type (for example, Object Model, Activity, Statechart) by project. For example, in
your Handset project, you can use the ObjectModelGe::Depends::line_style property to
set Dependency lines for Object Model diagrams to be a spline shape. You should set this
property when you begin a project, as it takes effect going forward.
In addition, you can customize a line by adding/removing user-defined points to an arrow element.
To add a user-defined point, click Add. Note that the new point is added at the
location where you accessed the menu.
To remove a point, click Delete. Rational Rhapsody removes the point closest to
the location where you accessed the menu.
Note that you can reshape the line when the cursor changes to the icon shown in the following
figure:
When you draw a box or a line, the cursor displays in the name field so you can edit it
immediately. Type a name and press Ctrl+Enter. Note that names, except for activity
flow labels, are limited to one line. To add an extra line to a activity flow label, press
Enter.
For activity flows in statecharts and activity diagrams, you can select the Name tool. The
cursor changes from an arrow to a pen. Click to select the name position, type a name, and
click outside the element to finish.
To edit an existing name, do one of the following actions:
Note
If you rename a class box, you are renaming the class in the model.
The Free Shapes toolbar provides tools that enable you to customize your diagrams using
freestyle shapes and graphic images.
Closed Curve Draws a closed, curved shape within the bounds of the specified shape.
2. Click in the diagram and drag the cursor away from the endpoint to create the line. The
line is shown as a dashed line until you click to end the line.
If you click too early so only the square endpoint is displayed, click the endpoint and
redraw the line.
3. Drag the cursor away from the endpoint, clicking once to place each subsequent point in
the polyline.
Drawing polygons
To draw a polygon:
2. Click twice in the diagram to define two endpoints of a side, then drag and click to define
the polygon.
For example, to draw a triangle, simply define one side and drag the cursor to form the
triangle.
Drawing rectangles
To draw a rectangle:
2. Click once in the diagram. By default, Rational Rhapsody draws a square with the
selection handles active.
2. In the diagram, click to define several points that define the curve. As you define points
(and, therefore, line segments), the resulting curve is drawn as a dashed line.
Similarly, the Closed Polycurve tool creates a closed polycurve. As you define line segments, a
dashed line shows the shape of the resulting closed curve.
2. Click once in the diagram to place the left-most point of the ellipse.
3. Holding down the mouse button, drag the cursor to create the ellipse or circle.
4. Release the mouse button to complete the shape.
Drawing text
To create floating text:
4. Press Enter for a new line; press Ctrl-Enter to place the text and dismiss the text box.
To change the text color, font, size, and so on, right-click the text and select Format. For more
information on changing text attributes, see Change the format of a single element.
Adding images
To add an image to your diagram:
2. Navigate to the directory that contains the image you want to add to the diagram.
Note
The Rational Rhapsody distribution includes numerous bitmaps for common design
elements, such as CDs, timeouts, displays, and so on. These images are available in
Share\PredefinedPictures under the root installation directory.
4. Move the cursor to where you want to add the image, then click once to place it.
To display the grid, click the Grid tool or select Layout > Grid > Show Grid.
Autoscroll
By default, Rational Rhapsody automatically scrolls the diagram view while you are busy doing
another operation (such as moving an existing box element or drawing new edges by dragging)
that prevents you from doing the scrolling yourself. The autoscroll begins scrolling when the
mouse pointer enters the autoscroll margins, which are virtual margins that define a virtual region
around the drawing area (starting from the window frame and going X number of points into the
drawing area).
You can change the size of the autoscroll margins by setting the property
General::Graphics::AutoScrollMargin. This property defines the X number of points the
margins enter into the drawing area. If you specify a large number for this property, the margin
becomes bigger, thereby making the autoscroll more sensitive.
Select elements
There are many ways Rational Rhapsody enables you to select elements in diagrams. You can
select an element using the mouse or using a variety of menu commands. Once you have selected
an element, you can edit it depending on what kind of element it is.
1. Click the Select tool. When you move the mouse over the diagram, a standard mouse
pointer is displayed.
2. Click an element. When you select an element, all other elements are deselected.
You can select the control point of an arrow only by clicking and dragging. For more
information, see Clicking-and-dragging.
b. To select a box, click anywhere inside it or on its border.
Edit > Select > Select All selects all elements in the diagram.
Edit > Select > Select Next selects the element next to the current one, when two
elements are close together. This lets you easily navigate to each element in a diagram,
one at a time.
Edit > Select > Select by Area enables you to draw a selection box around a group of
elements within a container element (for example, classes in a package).
Edit > Select > Select Same Type selects all of the elements in the diagram that are of the
same type as the element currently selected. If more than one type of element is selected,
then all the elements of the different selected types will be selected.
Selection handles
When an element is selected, selection handles are displayed around its edges. The following
diagrams selection handles on different elements.
Arrows and lines have a marker on each end and on each control point on the line.
Non-rectangular elements, such as use cases or actors, and groups of elements have an invisible
bounding box with eight visible handles.
Note
The cursor changes depending on how the selected element will be changed. If the cursor is
displayed as a four-pointed arrow, the selected element can be moved to a new location. If
the cursor changes to a two-headed arrow, you can resize the element.
Shift+Click
Clicking-and-dragging
Note that the last element selected in a multiple selection is distinguished by gray selection
handles. Gray handles indicate that the element is an anchor component. Rational Rhapsody uses
anchor components as a reference for alignment operations. If you want to use a different
component as the anchor, hold the Ctrl key down and click another element within the selection.
Rational Rhapsody transfers the gray handles from the previous element to the selected element
Shift+Click
1. Click the first element you want to select.
2. Press and hold down the Shift key, then click the rest of the elements you want to select.
Note
To remove an element from the selection group, press and hold down the Shift key and click
the element you want to remove from the selection.
Clicking-and-dragging
To make a multiple selection using the click-and-drag method:
4. To add more elements to the selection, hold down the Shift key while you click-and-drag
again.
Edit elements
You can edit elements using the following methods:
Resizing elements
You can resize an element by stretching its sides. You can resize only one element at a time.
To resize an element:
3. Click-and-drag the mouse until the element is the wanted size and shape. If you want the
element to maintain its proportions as you resize it, hold down the Shift key before you
begin to click-and-drag.
If the box you are editing contains text, the text wraps to fit inside the boundaries of the new box.
If you are editing a box that is connected to other lines or contains other elements, the lines and
elements move and resize according to the box as you stretch it. If you hold down the Shift key,
you can stretch diagonally while maintaining the scale for the element.
To prevent elements from being resized when you resize their parent, press and hold the Alt key
while you click-and-drag with the mouse. Alternatively, you can select the menu item Edit >
Move/Stretch Without Contained before resizing the element.
To make Rational Rhapsody automatically enlarge the text box of a box element to fit the size of
an element name, select the Expand to fit text in the menu. Alternatively, select Layout >
Expand to fit text. Note that once you apply this feature to an element, it remains available until
you resize the element.
See the description of the Reroute command in Changing the line shape for information on
removing extra control points.
Moving elements
You can move an element by clicking on it and dragging it to a new location. You can move
several elements simultaneously.
To move an element:
2. Move the mouse pointer over the element. The cursor changes to a four-pointed arrow,
which denotes a move operation.
To prevent elements from being moved when you move their parent boxes, hold down the
Alt key while you click-and-drag with the mouse. Alternatively, you can select the menu
item Edit > Move/Stretch Without Contained before moving the element.
If you hold down the Ctrl key when moving an element, a copy of the selected element is
created.
If you hold the Shift key down when moving an element, you can move it only
horizontally or vertically.
When moving or stretching more than one element at the same time, lines maintain their ratio to
the other elements. That is, the line stretches and moves along with the other elements. This can be
problematic for straight lines, which do not remain straight.
To maintain straight lines when moving or stretching boxes, move the boxes one at a time.
When moving or stretching only one box, lines that connect with vertical boundaries of the box
maintain their Y-coordinate, and lines that connect with horizontal boundaries of the box maintain
their X-coordinate. The coordinates change only when the box is moved to the extent that
maintaining those coordinates is impossible. This way, lines that are straight remain straight
whenever possible.
The Format window lists the current line, fill, and font information for the selected element. The
following figure shows the default line attributes for a class.
Use the Line tab of the window to change the line color, style, or width or the lines used to draw
the element.
Note
Line widths 0 and 1 are the same; however, you can specify a new line type (dashed, dotted,
and so on) only for line width 0. Otherwise, the style options remain unavailable.
The Fill tab enables you to specify new fill attributes for the specified element, including the fill
and pattern colors, and the pattern style. The following figure shows the Fill tab for a class.
A preview of the pattern is displayed in the small box beside each pattern name.
For example, the following figure shows the preview of a fill color of green, a pattern color of
blue, with the Transparent pattern check box cleared.
The Font tab enables you to specify new font attributes for the specified element, including the
font size and type, color, and whether the text should be in italics or bold, or underlined. The
following figure shows the Font tab for a class.
Note
These settings apply only to the specified element. Therefore, if you change the attributes
for an individual class, any new classes will use the default attributes. For information on
changing the attributes for a specific type of element (for example, all classes), see Change
the format of a single element.
Font Color Specifies the color to use for the text or label of the selected element. For
example, if you select a state and use this tool to change the color to red, the
name of the selected state is displayed in red.
This tool performs the same action as right-clicking an element and selecting
Format.
Line Color Specifies the color to use for the selected line element. For example, if you
select a state and use this tool to change the line color to blue, the text box for
the state will be displayed in blue.
This tool performs the same action as right-clicking an element and selecting
Format.
Rational Rhapsody provides a Format Painter button to copy formatting from one element to
another element in the same diagram.
1. In the diagram, click the element whose formatting you want to copy.
2. Click the Format Painter button in the Standard toolbar.
3. Click the element to which you would like to apply the copied formatting.
To copy formatting without having to click the Format Painter button each time:
1. In the diagram, click the element whose formatting you want to copy.
4. Click the elements to which you would like to apply the copied formatting.
Note
The Stamp Mode button is a toggle button. Rational Rhapsody will remain in “stamp mode”
until you click the button a second time.
1. Right-click the diagram and select Format to open the Format window.
Note: For diagrams only, the Format window has an Apply to modified elements
check box. For projects, packages, and stereotypes, there is an Apply to sub
elements check box instead.
2. In the Select Meta-class to format box, select the metaclass whose attributes you want to
change, then click the Format selected meta-class button.
Note: The Select Meta-class to format box displays only the metaclasses that are
relevant for the type of diagram.
3. Use the Format Properties window to select the new line, fill, and font attributes for the
metaclass and click OK. (For more information about using the Format Properties
window, see Change the format of a single element). The Preview box on the Format
window displays how the element will look in the diagram.
Note: If Apply to modified elements is available when you click OK, all the existing
elements in the selected scope (of the given metaclass) are changed to the
specified format (in addition to any elements that are created later). If Apply to
modified elements is unavailable, existing elements of the specified metaclass
that have individual overrides are not changed, but new elements will use the
new style by default.
For example, consider the case where all actors have white fill by default, but
actor A has blue fill with yellow stripes. If you change the default fill color for
all actors to be green, and Apply to modified elements is available, all the
actors will have white fill. However, if you clear this check box, all the actors
will have white fill, except for actor A, which will keep the blue fill and yellow
stripes. All subsequently created actors will use white fill.
c. Reset to remove all user-specified formats for the specified element and “rolls back”
to the default values.
Note: If Apply to modified elements is available when you click Reset, Rational
Rhapsody displays a confirmation window that asks whether you want to reset
the default values for all of the modified subelements in the specified diagram
or project. Click Yes to remove all overrides; otherwise, click No and clear this
check box to reset specific metaclass styles.
d. Enforce to force a subelement to use the locally modified style. Note that this affects
only the styles that were explicitly specified; other formats remain unchanged. It is
similar to the behavior specified in Change the style scope.
Note: If Apply to modified elements is available when you click Enforce, Rational
Rhapsody displays a confirmation window that asks whether you want to force
the local style on all the elements in the specified diagram. Click Yes to remove
all overrides; otherwise, click No and disable this check box to reset specific
metaclass styles. Note that if you apply Enforce without enabling the Apply
check box, nothing is changed.
Use Edit > Format > Un-override to remove overrides on boxes and line elements in diagrams.
If you open the Format window from within a diagram, the format change applies only to
the metaclass in the current diagram.
For example, if you change the format of states in the Tester statechart so they are filled
with yellow, states in other statecharts will not be filled with yellow automatically.
If you open the Format window at the project level (select the project node in the browser,
right-click and select Format), the specified style is applied to that metaclass throughout
the entire model.
If you open the Format window by selecting an individual element in a diagram, the
specified style will be applied to that element only.
If you apply a style to an individual element and then copy it to a new diagram, it brings its style
with it. Consider the following scenario:
If you copy classes A and B into OMD_B, class A keeps its individual style, but class B now uses the
default local style (yellow fill). The following figure shows OMD_B.
To force the class to use the local style, click Enforce. In this example, class A is now forced to use
yellow as its fill color. Note that the cross-hatching is still used (because there is no setting for
cross-hatching in this OMD).
To make the formatting of an element the default formatting for elements of that type:
1. Right-click the element in the diagram and select Make Default (or select the element and
choose Edit > Make Default). The Make Default window opens.
2. Select the characteristics to set as default. The available options are format, display
options, and size.
3. Select the level at which you would like to set the defaults, for example, diagram level or
package level.
Note
This option sets the default formatting for all new elements of the same type. For elements
that already exist in the diagram, the default formatting will be applied unless the elements
have been overridden. (This applies only to the formatting; the size of existing elements will
not be changed, nor will the display options.)
Copy an element
There are two different ways in which elements can be copied and pasted in a diagram:
Simple Copy where another representation of the element is created on the diagram
canvas.
Copy with Model where a new element is created in the model and pasted into the
diagram. The new model has the exact same characteristics as the original element.
Simple copy
You can copy an element in one of three ways:
3. Press Ctrl. A small box with a plus sign in it is displayed below and to the right of the
pointer.
4. Click-and-drag the element. When you release the mouse button, a copy of the element
displays in the new location.
Note
In statecharts, copying creates new elements. In OMDs and UCDs, these methods copy
graphic elements but do not create new elements in the model.
Replicating
To copy using the Replicate command:
3. Enter the number of rows and columns you want the copied elements to use and the
spacing between them.
4. Click OK. Rational Rhapsody displays the replicated elements in the diagram.
2. From the main menu, select Edit > Copy with Model.
3. Navigate to the diagram where you would like to paste the new object.
4. From the main menu, select Paste. The new element will appear in the diagram as well as
in the browser.
5. Rename the new item if wanted. The default name will be the name of the original element
with the string “_copy” appended to it.
Arranging elements
In addition to the grid and ruler tools (described in Placing elements using the grid), the Layout
toolbar includes several tools that enable you to align elements in the drawing area.
To arrange elements:
1. Select View > Toolbars > Layout. The Layout toolbar is displayed.
Note that the selection handles use different colors to show which element is used for the default
alignment and sizing (the last element selected).
The selection handles on class A are gray, which denotes that Rational Rhapsody will use the
values of class A for any alignments and sizing. Therefore, if you align the left sides of class A and
B, class A stays where it is and class B moves under it, as shown in the following figure.
Layout toolbar
The Layout toolbar provides quick access to tools that help you with the layout of elements in
your diagram, including a grid, page breaks, rulers, and so on. To display or hide this toolbar,
choose View > Toolbars > Layout.
Tool
Name Description
Button
Toggle Grid Displays or hides the grid in the drawing area. This is equivalent to selecting
Layout > Grid > Show Grid.
Snap to Grid Automatically aligns new elements to the closest grid points. This is equivalent to
selecting Layout > Grid > Snap to Grid.
Toggle Rulers Displays or hides the rulers in the drawing area. This is equivalent to selecting
Layout > Show Rulers.
Toggle Page Displays or hides the page breaks in your diagram. This is equivalent to selecting
Breaks Layout > View Page Breaks.
Page boundaries are denoted by dashed lines.
Stamp Mode Turns repetitive drawing mode on or off.
Align Top Aligns the selected elements to the top of the element with the gray selection
handles. This is equivalent to selecting Layout > Align > Top.
Align Middle Aligns the selected elements to the middle (along the horizontal) of the element with
the gray selection handles. This is equivalent to selecting Layout > Align > Middle.
Align Bottom Aligns the selected elements to the bottom of the element with the gray selection
handles. This is equivalent to selecting Layout > Align > Bottom.
Align Left Aligns the selected elements to the left side of the element with the gray selection
handles. This is equivalent to selecting Layout > Align > Left.
Align Center Aligns the elements so they are aligned to the center, vertical line of the element with
the gray selection handles. This is equivalent to selecting Layout > Align > Center.
Align Right Aligns the selected elements to the right side of the element with the gray selection
handles. This is equivalent to selecting Layout > Align > Right.
Same width Resizes all the selected elements so they are the same width as the element with
the gray selection handles. This is equivalent to selecting Layout >
Make Same Size > Same Width.
Tool
Name Description
Button
Same height Resizes all the selected elements so they are the same height as the element with
the gray selection boxes. This is equivalent to selecting Layout >
Make Same Size > Same Height.
Same size Resizes all the selected elements so they are the same size as the element with the
gray selection boxes. This is equivalent to selecting Layout > Make Same Size >
Same Size.
Space across Spaces the selected elements so they are equidistant (across) from the element with
the gray selection handles. This is equivalent to selecting Layout > Space Evenly >
Space Across.
Space down Spaces the selected elements so they are equidistant (down) from the element with
the gray selection handles. This is equivalent to selecting Layout > Space Evenly >
Space Down.
2. Press the Delete key. The element is removed from the view.
Alternatively, right-click the element in the diagram and select Remove from View.
Alternatively, right-click the element in the diagram and select Delete from Model.
Editing text
To edit text:
3. To add another line of text, press Enter; press Ctrl+Enter to end the edit.
Note that both the right mouse button and the Esc key cancel the edit.
Alternatively, for some features you can right-click the element in the drawing area and select Edit
Text.
Display compartments
One of the display options available for diagram elements is the display of contained items in
visual compartments. This option is available for the following items:
Classes
Objects
Files
For the above elements, the following items can be displayed in compartments where applicable:
Constraints
Tags (both local and on the element's stereotype)
Ports
Parts
2. In the window that is displayed, use the arrows to select the items that should be
displayed, and the order in which they should be displayed.
3. Click OK.
In each compartment, individual items are displayed with an icon indicating the type of sub-
element. If the text is too long to display, an ellipsis is displayed. When this ellipsis is clicked, you
can view/edit the full text.
Note
For constraints, the content of the specification field is displayed.
The name of items can be edited in the compartments but items cannot be added or deleted.
It is not possible to modify the order in which individual items are displayed within each
compartment.
User-defined terms are displayed in the same compartment as the item on which they are based,
however, the icon indicates that this is a user-defined term.
Note
While this feature allows you to display/hide attributes and operations, it does not replace
the attribute and operation tabs, which allow more precise display options, such as the
display of only a subset of defined attributes and operations.
Zoom
There are several zoom tools available on the Zoom toolbar, shown in the following figure.
Alternatively, you can choose View > Zoom/Pan > 50%, View > Zoom/Pan > 75%, View >
Zoom/Pan > 100%, or View > Zoom/Pan > 200%; or use the zoom options available in the menu
in the drawing area.
To prevent elements from being resized when you resize their parent (for example, classes
contained in a composite class), press and hold the Alt key while you click-and-drag with the
mouse.
Zoom toolbar
The Zoom toolbar contains the zoom tools you can use with all the different diagram types. These
tools are also available in View > Zoom or View > Zoom/Pan. To display or hide this toolbar,
choose View > Toolbars > Zoom.
Tool
Name Description
Button
Zoom In Zooms in on a diagram. Click this button and click in a graphic editor window to
increase the view by 25%.
Zoom Out Zooms out on a diagram. Click this button and click in a graphic editor window to
decrease the view by 25%
Zoom to Select an element in a diagram and click this button to zoom into the selected
Selection section of the diagram.
Alternately, you can click Zoom In and hold down the left mouse button to draw a
selection box around the part of the diagram you want to zoom in on.
Pan Moves the diagram in the drawing area so you can see portions of the diagram that
do not fit in the current viewing area.
Zoom to Fit Resizes the active diagram to fit within the graphic editor window.
Tool
Name Description
Button
Undo Zoom Reverses the last zoom action.
Scale The options on this drop-down list resize the active diagram scale by the selected
Percentage percentage.
Specification/ Displays either the specification or structured view of the active diagram.
Structured View
1. Click the Zoom In or Zoom Out button (or choose View > Zoom > Zoom In or View >
Zoom > Zoom Out).
2. Move the cursor over the diagram. The cursor displays as a magnifying glass with either a
plus or minus sign in it.
3. Click the diagram to enlarge or shrink it by 25%, depending on which tool you selected.
Click the Zoom In button, then hold down the left mouse button to draw a selection box
around the part of the diagram you want to zoom in on.
Select an element in the diagram, then click Zoom to Selection to enlarge the selected
element so it takes up the entire drawing area.
Note
You remain in zoom mode until you select another tool from the toolbar.
Scaling a diagram
To scale a diagram to a certain percentage, use the drop-down scale box. You can set the diagram
scaling to a value between 10% and 500%.
Alternatively, select View > Zoom/Pan, then select the percentage used to scale the diagram.
To scale the diagram so the entire diagram in visible in the current window, click the Zoom to Fit
button (or View > Zoom/Pan > Zoom to Fit). When you click the button, the diagram is resized to
fit in the current window. This button performs the same command as View > Zoom to Fit.
Panning a diagram
Click the Pan button to move the diagram in the drawing area so you can see portions of the
diagram that do not fit in the current viewing area.
Undoing a zoom
To undo the last zoom, click the Undo Zoom button, or select View > Zoom/Pan > Undo Zoom/
Pan.
For example, suppose you have a structured (composite) class A that contains the parts ObjectA
and ObjectB. The structured view looks like the following figure.
In addition to toggling between the two views, any new classes or objects created with the selected
mode will use that mode.
Note that if there is a mix of structured and specification elements, the button is disabled.
The Bird’s Eye contains a depiction of the entire diagram being viewed, and a rectangle viewport
that indicates which portion of the diagram is currently visible in the drawing area.
Using the Bird’s Eye to enlarge and shrink the visible area
To use the Bird’s Eye to enlarge/shrink the visible area of the diagram, drag an edge or corner of
the viewport to enlarge/shrink the viewport.
Enlarging the viewport has the same effect as zooming out in the drawing area. Shrinking the
viewport has the same effect as zooming in the drawing area.
Note
When you drag an edge of the viewport, the viewport size will always change in both
dimensions, maintaining the height/width ratio.
By default, the viewport will grow in the direction of the edge selected. If you hold down
Ctrl while dragging, however, the viewport will grow in the direction of the opposite edge
as well in order to maintain the current center point of the diagram.
If the zoom level is changed in the drawing area, the size of the viewport will change accordingly
in the Bird’s Eye window.
To display the viewport appearance window: Right-click anywhere in the Bird’s Eye window.
Complete relations
The Layout > Complete Relations menu completes relation lines in diagrams. For example, you
can define relations in the browser, draw the participating classes in an OMD, then select
Complete Relations to speed up the drawing of the relation lines.
Layout > Complete Relations > All completes all the relation lines
Layout > Complete Relations > Selected to All completes relation lines only for
relations originating in the selected classes
Layout > Complete Relations > Among Selected completes relation lines only for
relations existing between the selected classes
Use IntelliVisor
The IntelliVisor feature offers intelligent suggestions based on what you are doing to reduce:
Activating IntelliVisor
When you press Ctrl+Space in the graphic editor, Rational Rhapsody displays a list box with
information from which to choose. You can navigate in this list box using either the arrow keys or
the mouse. When you select an item from the list of suggestions and press Enter, that text is
placed in the text box.
IntelliVisor information
When you are using a graphics editor, IntelliVisor can simplify your tasks by offering shortcuts to
similar model elements.
For example, if you are drawing a class in an OMD or structure diagram and start IntelliVisor, the
list box contains the default name of the new class and all the classes that already exist in the
model. If you highlight one of the classes in the list, IntelliVisor displays summary information
available for that element, including:
To replace the new class with an existing class, simply highlight the class in the list box and double
left-click. IntelliVisor replaces the new class with the specified class.
In addition to classes, IntelliVisor can be opened in OMDs when you are drawing actors and
packages.
Collaboration diagrams
If you open IntelliVisor on an object or multi-object, the list box contains all the classes in the
current project. For example:
If you apply a selection from the list, IntelliVisor replaces the part after the role name. For
example, AcmeTank:Tank will become AcmeTank:Jet if you select the Jet class in the list box.
In addition to classes, IntelliVisor can be started in collaboration diagrams when you are drawing
actors.
Component diagrams
If you start IntelliVisor for a component in a component diagram, the list box contains all the
components in the model. For example:
Deployment diagrams
If you start IntelliVisor on a node in a deployment diagram, the list box contains all the nodes
defined in the model. For example:
Sequence diagrams
If you start IntelliVisor within a sequence diagram, the list box contains the events, operations, and
triggered operations consumed by the target class. If there are base classes that consume events,
operations, and triggered operations, they are included in the list.
If you start IntelliVisor after the “/” or “[” symbol, the list box contains the default class content.
For example:
In addition, you can start IntelliVisor in activity diagrams to help you perform the following tasks:
Similarly, if you start IntelliVisor on a use case, the list box contains all the use cases defined in the
project.
Structure diagrams
If you start IntelliVisor for an object in a structure diagram, the list box contains all the objects
defined in the project. For example:
Similarly, if you start IntelliVisor on a composite class, the list box contains all the composite
classes defined in the project.
Add helper applications (also know as helpers). Helpers are custom programs that you
attach to Rational Rhapsody to extend its functionality. They can be either external
programs (executables) or Visual Basic for Applications (VBA) macros that typically use
the Rational Rhapsody COM API. They connect to a Rational Rhapsody object via the
GetObject() COM service. See Helpers.
Use Visual Basic for Applications (VBA), an OEM version of Microsoft Visual Basic to
develop automation and extensibility scripts that interact with the tool repository that
provides a full complement of user interface components (“forms”). See Visual Basic for
applications.
Create a customized profile to use in the models for your company. A customized profile
has the following advantages:
– Contains terminology specific to your company
– Forces adherence to special requirements or industry standards
– Can be reused in other models to simplify and standardize development efforts
See Creating a customized profile.
Add new element types to your models. See Adding new element types.
Create a customized diagram. See Creating a customized diagram.
Customize the Add New menu. See Customize the Add New menu.
Create a Rational Rhapsody plug-in. See Creating a Rational Rhapsody plug-in.
Helpers
Helpers are custom programs that you attach to Rational Rhapsody to extend its functionality.
They can be either external programs (executables) or Visual Basic for Applications (VBA)
macros that typically use the Rational Rhapsody COM API. They connect to a Rational Rhapsody
object via the GetObject() COM service.
You can add your helper to the Rational Rhapsody Tools menu. To open, the Helpers window,
open a Rational Rhapsody project and choose Tools > Customize.
Click the Move Up icon to move up the helper item on the Rational Rhapsody Tools
menu.
Click the Move Down icon to move down the helper item on the Rational Rhapsody
Tools menu.
Use the following boxes on the Helpers window to identify and apply your helper application:.
At the bottom of the window, identify if your helper application is an external program helper or
VBA macro helper.
1. Open a Rational Rhapsody project and choose Tools > Customize to open the Helpers
window.
2. Click the New icon to add a blank line for a new menu item in the Menu content box.
3. In the blank field, type the name of the new menu item (for example, My New Command).
To specify a submenu structure, enter the menu text with a backward slash ( \ ), for
example, External\My New Command1.
Note that you can have more than one item in your submenu structure. You can
create another link to a helper and specify it as, for example, External\My New
Command2.
To make a shortcut key, add an ampersand character before a letter in the name.
For example, &My makes the letter M a menu shortcut. You can press Alt+M to
open this particular helper application once it has been created. Be sure to not use
a letter that is already used as a shortcut key on the Tools menu or the pop-up
menu for the associated model element.
4. Specify the applicable helper parameters:
In the Command box, enter the command that the menu item should start, such as
E:\mks\mksnt\cp.exe or click its Ellipsis button to browse to the location
of the application.
Optionally, in the Arguments box, enter any arguments for the command.
Optionally, in the Initial Directory box, enter an initial default directory for the
program. This applies only to external programs.
In the Applicable To list, specify which model elements to associate with the new
command.
If you do not specify a value for this field, the menu command for this helper
application can be added to the Tools menu depending on what you do in Step 6.
In the Project Type list, select a project profile, as defined in Creating a project.
If leave this box blank, it uses as the default the profile of the current project you
have opened.
In the Helper Trigger list, select the actions that triggers the new command.
Select the External program radio button if the new command is an external
program, such as Microsoft Notepad.
Select the Wait for completion check box if you want the external program to
complete running before you can continue to work in Rational Rhapsody.
Select the VBA macro radio button if the new command is a VBA macro and is
defined in the <Project>.vba file. See Adding a VBA macro.
6. Depending on what you decided for the Applicable To list:
If you did not specify an applicable element for the command, verify that the
Show in Tools menu check box is selected. This means the new menu command
for your link to a helper application displays on the Tools menu. If you clear this
check box, there is no menu command for it on the Tools menu, though the link to
the helper application still works once the trigger for this command is started.
If you specified an applicable element for the command, verify that the Show in
Pop-up menu check box is selected. This means the new command displays in
the menu for the specified model element. If you clear this check box, there is no
menu command for it on the pop-up menu for the specified model element,
though the link to the helper application still works once this command is started.
7. Click OK to apply your changes and close the window. (You can click the Apply button if
you want to save your changes but keep the window open to continue working with it.)
Once you save and close the Helpers window, the link to the helper application you just
created is immediately available if the current project is within the parameters that you set
for the link. For example, if the Rational Rhapsody project you currently have open uses
the FunctionalC profile and you created the My New Command helper application for this
profile, then this link to the helper application is immediately available. However, if you
specified the DoDAF profile (as selected in the Project Type drop-down list) for the My
New Command link, then it will not work in your current project.
If you specified an applicable model element for your command and you selected the Show in
pop-up menu check box on the Helpers window, as shown in the following figure on the left, you
can right-click either the model element on the Rational Rhapsody browser to access the menu
command for the helper application, as shown on the right, or the applicable element in a graphical
editor. Note that the command now does not show on the Tools menu.
Using a .hep file is ideal for teams where all members should use the same helper applications.
When your project profile and its corresponding .hep file are loaded by reference, when your team
members update, they get the latest versions of these files. A .hep file is considered part of a
profile and is treated as such.
To see sample .hep files, you can look at the ones provided with the Rational Rhapsody product for
certain profiles, such as AUTOSAR, DoDAF, MODAF, NetCentric, and Harmony. For example,
<Rational Rhapsody installation path>\Share\Profiles\DoDAF contains DoDAF.sbs (the
profile file) and DoDAF.hep. Java users might want to look at the sample .hep files for the
AUTOSAR and NetCentric profiles.
If sharing links to helper applications is not an issue, or perhaps it is company policy that everyone
have access to the same helper applications for all Rational Rhapsody projects, then adding links
to helper application in the rhapsody.ini file might suffice.
Easier maintenance. The rhapsody.ini file is typically overwritten when you get a new
version of Rational Rhapsody. Since the name of a .hep file must correspond with the
name of a profile, there is less likelihood of the .hep file being overwritten.
Less clutter on your list of menu commands. The links to help applications can appear as
menu commands on the Tools menu. Typically, many people work on various projects
that might use different models (and profiles) and different helper applications. Using the
rhapsody.ini file to store all your links to helper applications might cause clutter on
your list of menu commands. You can use a different .hep file for each profile so that you
only see the helpers needed for your project.
Note
The method described here is the typical way to link to a helper application. If you prefer to
not use Tools > Customize (which opens the Helpers window), you should review the
options on the Helpers window to familiarize yourself with the available options and their
syntax. For example, look at the Helper Trigger box for the list of available triggers and
notice how they are spelled out and capitalized. For more information about the Helpers
window, see Helpers.
1. Open Rational Rhapsody and choose Tools > Customize to create one or more links to
helper applications. See Creating a link to a helper application.
3. Open the rhapsody.ini file and from the [Helpers] section of the file, copy the code for
your help application. The following example show helper application code that was
added to the rhapsody.ini file:
[Helpers]
...
name30=AutoCommand45
command30=C:\WINDOWS\NOTEPAD.EXE
arguments30=
initialDir30=C:\WINDOWS
JavaMainClass30=
JavaClassPath30=
JavaLibPath30=
isVisible30=1
isMacro30=0
isPlugin30=0
isSynced30=0
UsingJava30=0
applicableTo30=
applicableToProfile30=Auto2009
helperTriggers30=After Project Open
isPluginCommand30=0
Your .hep file must have the same name as the name of the profile for your Rational
Rhapsody project. For example, if the profile for your Rational Rhapsody project is called
Auto2009, your .hep file must be called Auto2009.hep. In addition, both the profile and
the .hep file must reside in the same folder.
5. In the rhapsody.ini file, delete the code that you copied in Step 3. The code to link to a
helper application should only reside in the .hep file when you are using a .hep file.
7. Load the applicable profile by reference. This is the profile that has the corresponding .hep
file; see Step 4.
Note
You can use the General::Model::HelpersFile property to associate a .hep file with a
model.
Note that if you specify a .hep file using this property, Rational Rhapsody will not recognize
the helper applications defined in the profile-specific .hep file if one is provided for the
profile you are using.
1. With a project open in Rational Rhapsody, choose Tools > Customize to open the Helpers
window.
2. If you want to edit the name of the helper application, double-click it in the Menu content
box and make your changes.
3. Make other changes on the Helpers window as you want. For an explanation of the
controls on the Helpers window, see Creating a link to a helper application.
2. Open the .hep file in a text editor (such as Microsoft Notepad) and make your changes.
1. With a project open in Rational Rhapsody, choose Tools > Customize to open the Helpers
window.
2. Click the New icon to add a blank line for a new VBA macro menu command in the
Menu content box.
3. In the blank field, type the name of the new menu item (for example, My VBA Command).
4. Select the VBA macro radio button as the helper type. The Helpers window lists
VBA-specific options.
If you do not specify a value for this field, the menu command for this link to a
helper application might be added to the Tools menu depending on what you do
in Step 6.
In the Project Type list, select a project profile, as defined in Creating a project.
If leave this box blank, it uses as the default the profile of the current project you
have opened.
In the Helper Trigger list, select the actions that triggers the new command.
6. Depending on what you decided for the Applicable To list:
If you did not specify an applicable model element for the command, verify that
the Show in Tools menu check box is selected. This means the new menu
command for your link to a helper application displays on the Tools menu. If you
clear this check box, there is no menu command for it on the Tools menu, though
the link to the helper application still works once the command is started.
If you specified an applicable model element for the command, verify that the
Show in Tools menu check box is selected. This means the new command
displays in the menu for the specified model element. If you clear this check box,
there is no menu command for it on the pop-up menu for the specified model
element, though the link to the helper application still works once the command is
started.
7. Click OK.
The helper application you just created is immediately available if the current project is
within the parameters that you set for the helper application. For example, if the Rational
Rhapsody project you currently have open uses the FunctionalC profile and you created
the My New Command helper application for this profile, then this helper application is
immediately available. However, if you specified the DoDAF profile (as selected in the
Project Type list) for the My New Command helper application, then it will not work in
your current project.
Note
It is your responsibility to add code to your VBA macro to verify that the selected object is
actually the core object for your command. The COM command to get the selected element
is getSelectedElement().
With VBA, you can develop automation and extensibility scripts that interact with the tool
repository that provides a full complement of user interface components (“forms”). There is
virtually no limit to application extensibility that can be achieved using VBA. Conceptually, it
would be possible to completely transform the hosting application into another application using
VBA extensibility.
Each Rational Rhapsody project is associated with a single VBA project that contains all VBA
artifacts (scripts, forms, and so on) that you created within the Rational Rhapsody project. This
project file has the name <project name>.vba and is located in the same directory as the
Rational Rhapsody project file (<project>.rpy). This binary file will be loaded (if present) with
the Rational Rhapsody project and saved when you select Save from Rational Rhapsody or the
VBA IDE.
Whether accessed by VB or VBA programs, operations of the Application object are identical
in function. To the VBA user, however, it looks like all the methods of the root object are local
methods in the VBA context. For example, traversing the Rhapsody model always starts with
accessing the project object. The following example shows a VBA script that displays the name of
the project:
Dim a as Object
Set a = getProject
MsgBox a.name
a. Select View > Toolbars > VBA and then select the first icon from the left to launch
the VBA IDE.
b. Select Tools > VBA and then select Visual Basic Editor from the popup menu.
2. Edit the Visual Basic project file, <project>.vba, to implement different macros. Once
you are finished editing, exit the VBA IDE and save the Rhapsody project. The VBA
project is automatically saved whenever the Rhapsody project is saved.
Start typing the new macro with the line Sub xxxx(), where xxxx is the name
of the new macro. The last line of the macro must be “End Sub.”
– Find an existing macro by expanding the Modules folder of the Project
window and double-clicking the appropriate module. You can scroll the code
window to the existing macro or select it in the right pull-down above the
code window.
This is a simple VBA macro:
Sub GetNameOfProject()
Dim a as Object
Set a = getProject
MsgBox a.name
End Sub
Once you have finished typing this macro, return to the Rhapsody window and run the new macro
through the Macros window. You see a small message box with the name of the currently loaded
project.
To open the Macros window, use the VBA Toolbar shortcut or select Tools > VBA > Macros. The
following figure shows the Macros window. The window contains the following fields:
Macro Name contains the name of the highlighted macro in the Macro Box field. This
field is blank if there are no macros in the Macro Box.
Macro Box lists the available macros in the VBA project selected in the Macros In box.
Macros In lists the available VBA projects that contain macros.
The window contains the following buttons:
Step Into highlights the first line of the macro and places the Current Execution Line
Indicator.
Edit opens the Code window with the selected macro visible so you can modify your
macro.
To edit a macro, highlight the macro in the Macro box, then click Edit.
Create opens a module in the Code window so you can create a new macro.
To create a macro, type in a new name in the Macro Name field, then click Create.
Note: Since VBA macros are contained in modules, you must first create a module
before creating your first macro. If you have not yet created a module, the
Create button is disabled. Modules cannot be created from the Macros
window. You must open the VBA IDE to do so.
Delete removes the selected macro from your project.
To delete a macro, highlight a macro in the Macro box, then click Delete.
3. In the Export Files window, browse to the correct location and enter the name of the
receiving file.
Rational Rhapsody also enables you to import an existing module or form to the project.
1. From the VBA IDE, select File > Import File. The Import Files window is displayed.
1. Create a project that you want to use as the basis for your customized profile. If you select
a Rational Rhapsody profile for this project, the characteristics of that profile are going to
be used as the default values.
2. Right-click the top-level project name (for example, Dishwasher) and select Add New >
Profile, and then enter a name for your profile. Notice that Rational Rhapsody creates a
Profiles category and places your profile within it.
Alternatively, if you have a package that you want to change to be a profile, right-click the
package and select Change to > Profile. For more information, see Converting packages
and profiles.
3. Enter any information about the profile that you want your team members to know about
on the Description tab.
a. Define global tags for your profile: Open the Features window for the profile (for
example, double-click the profile name) and define tags on the Tags tab.
b. Add a stereotype to your profile: On the General tab of the Features window for your
profile, select <<New>> from the Stereotype box. A Features window opens for the
stereotype on which you can name the stereotype. Notice that by default Rational
Rhapsody sets that this stereotype is applicable to a profile. Notice also that you can
make it a New Term stereotype. For more information about creating stereotypes, see
Stereotypes.
After you close the Features window for the stereotype and return to the Features
window for the profile, notice that the stereotype you just created is showing in the
Stereotype box of the General tab for the profile.
1. Right-click your profile and select Add New > Stereotype. Remember to select the
metaclass to which the stereotype applies.
Later you can apply the stereotype to a profile by opening the Features window for the
profile and selecting the particular stereotype on the General box.
2. Once Rational Rhapsody creates the Stereotype category on the browser, you can
right-click the name and select Add New Stereotype to create more stereotypes.
1. Make a corresponding text file for your custom profile and give it the same name but with
the .txt extension. Add a description for the profile. The content of the text files displays
on the description area of the New Project window.
For example, if your customized profile is MyProfile.sbs, create a MyProfile.txt file.
2. Copy the .sbs file for the profile and the corresponding .txt file to <Rational Rhapsody
installation path>\Share\Profiles\<customized profiles foldername>. For
example, you would place a copy of the MyProfile.sbs and MyProfile.txt files in, for
example, C:\Rhapsody\Share\Profiles\CustomProfiles.
If you have packages under your profile, choose to not make each package its own
separate unit so that you can keep the entire profile in a single .sbs file (clear the Store in
separate file for those package).
3. When you want to use a custom profile with a new project, you can select the profile from
the Project Type drop-down list of the New Project window.
You can also share your custom profiles through the following methods:
Save the customized profile (package) and make it available through a CM system or in a
shared area where other developers can access it.
Add a custom profile to an existing project with File > Add Profile to Model. Select the
customized profile (an .sbs file) from its stored location.
Note that with this method certain elements might not be brought over to your new project
is they are not associated specifically with the profile/project.
When multiple projects are displayed in a browser, a developer can drag and drop the
customized profile from one project to a different open project to re-use it. For more
information about this process, see the instructions in Copy and reference elements among
projects.
Note
You can set your customized profile to be automatically added to a new project either as a
copy or a reference using the AutoCopied or AutoReferences properties. For more
information, see Profile properties.
2. Open the Features window for the new stereotype and select one item from the Applicable
To list. This item is the element on which the new element is based.
Once the new term is created, it is possible to add elements of this type via the context menu in the
browser.
Note
Since stereotypes can be added to profiles and packages, the new terms created can be
shared across models.
Note
To keep all of the out-of-the box metaclasses, leave this property blank.
To limit the availability of certain metaclasses, use this property to indicate the metaclasses that
you would like to have available. The strings to use to represent the different metaclasses are as
follows
ActivityDiagram
ActivityFlow
Actor
Argument
Association
AssociationEnd
Attribute
Block
Class
ClassifierRole
CollaborationDiagram
CombinedFragment
Comment
Component
ComponentDiagram
ComponentInstance
Configuration
Connector
Constraint
Constructor
ControlledFile
Dependency
DeploymentDiagram
Destructor
EnumerationLiteral
Event
ExecutionOccurrence
File
Flow
FlowItem
Folder
Generalization
HyperLink
InteractionOccurrence
InteractionOperand
Link
Message
Module
Node
Object
ObjectModelDiagram
Package
Pin
Port
PrimitiveOperation
Profile
Project
Reception
ReferenceActivity
Requirement
SequenceDiagram
State
Statechart
Stereotype
StructureDiagram
Swimlane
SysMLPort
Tag
Transition
TriggeredOperation
Type
UseCase
UseCaseDiagram
Note
The procedure for adding customized diagrams with custom elements can only be used for
adding new types of diagrams. It is not possible to add new diagram element types to the
standard Rational Rhapsody diagrams.
Customized diagrams can be added at the individual model level, or they can be added to profiles
so that they can be used with other models as well.
1. In the browser window, add your customized profile. See Creating a customized profile.
(While the customized diagram can be added for the current model only, usually
developers and designers want to add it to a profile so that it can be reused.)
2. Select the name of the new profile in the browser, and use the context menu to create a
new stereotype. See Stereotypes.
3. Open the Features window for the new stereotype you created, and set the following
values:
a. On the General tab, from the Applicable to list select the type of diagram that should
serve as the base diagram for the new diagram type you are creating. In addition,
select the New Term check box.
b. On the Properties tab, enter the required values for the following properties:
RpyDefault represents all the elements included in the Diagram Tools of the
base diagram. If this property is left empty, only the tools from the base
diagram is displayed. The toolbar can contain any drawable elements
supported by the base diagram, and any new elements based on these
elements.
1. Open the Features window for the profile to which you added the new type of diagram.
2. On the Properties tab, modify the value of the General::Model::DiagramsToolbar
property to include the name of the new diagram type in the comma-separated list, for
example, OV-1, RpySeparator,RpyDefault. (If this property is left empty, the toolbar
includes only the default icons.)
The strings to use in this list are given in Diagram types.
1. Select the name of the relevant profile in the browser, and use the context menu to create a
new stereotype.
2. Open the Features window for the new stereotype you created, and set the following
values:
a. On the General tab, from the Applicable to list select the type of drawing element
that should serve as the base element for the new diagram element type you are
creating. Also, select the New Term check box.
1. In the browser, under Stereotypes, select the customized diagram to which you would like
to add the custom element, and open its Features window.
Then names of the elements that can be used for this list are given in Diagram elements.
Note
After defining new diagrams or diagram elements, you need to reload the model to have
access to the new items or, alternatively, choose View > Refresh New Terms.
Diagram types
The following list contains the strings to use for the General::Model::DiagramsToolbar
property:
ActivityDiagram
CollaborationDiagram
ComponentDiagram
DeploymentDiagram
ObjectModelDiagram
SequenceDiagram
Statechart
StructureDiagram
UseCaseDiagram
RpyDefault
RpySeparator
Diagram elements
The following elements can be customized for the specified diagrams, as described in Adding
customized diagram elements.
AlternativeDrawingTool
Element Name Metaclass Name
Property Required
Object Model Diagram
Object Object
Class Class
Composite Class Class Yes
Package Package
Port Port
Inheritance Generalization
Association AssociationEnd
Directed Association AssociationEnd Yes
Composition AssociationEnd Yes
Aggregation AssociationEnd Yes
Link Link
Dependency Dependency
Flow Flow
Actor Actor
Sequence Diagram
InstanceLine ClassifierRole Yes
EnvironmentLine ClassifierRole Yes
Message Message
ReplyMessage Message Yes
CreateMessage Message Yes
DestroyMessage Message Yes
TimeoutMessage Message Yes
CancelTimeoutMessage Message Yes
TimeIntervalMessage Message Yes
PartitionLine ClassifierRole Yes
Condition Mark Message Yes
ExecutionOccurrence ExecutionOccurrence
AlternativeDrawingTool
Element Name Metaclass Name
Property Required
InteractionOccurrence InteractionOccurrence
InteractionOperatorCombinedFra CombinedFragment
gment
InteractionOperand InteractionOperand
Use Case Diagram
UseCase UseCase
Actor Actor
Package Package
Association AssociationEnd
Generalization Generalization
Dependency Dependency
System Border ClassifierRole Yes
Flow Flow
Collaboration Diagram
Classifier Role ClassifierRole Yes
Multi Object ClassifierRole Yes
Classifier Actor ClassifierRole Yes
AssociationRole ClassifierRole Yes
Link Message Message Yes
Reverse Link Message Message Yes
Dependency Dependency
Structure Diagram
Composite Class Class Yes
Object Object
Block Block
Port Port
Link Link
Dependency Dependency
Flow Flow
Deployment Diagram
Node Node
Component Component
AlternativeDrawingTool
Element Name Metaclass Name
Property Required
Dependency Dependency
Flow Flow
Component Diagram
Component Component
File File (Component)
Folder Folder
Dependency Dependency
Interface Class Yes
Realization Cannot use as base element
Flow Flow
Statechart
State State
ActivityFlow Transition
InitialFlow DefaultTransition
AndLine Cannot use as base element
StateChartConditionConnector Connector Yes
HistoryConnector Connector Yes
TerminationConnector Connector Yes
JunctionConnector Connector Yes
DiagramConnector Connector Yes
StubConnector Connector Yes
JoinConnector Connector Yes
ForkConnector Connector Yes
TransitionLabel Transition Yes
TerminationState State Yes
Dependency Dependency
Activity Diagram
Action State Yes
ActionBlock State Yes
SubActivityState State Yes
ObjectNode State Yes
AlternativeDrawingTool
Element Name Metaclass Name
Property Required
ReferenceActivity ReferenceActivity
Transition Transition
DefaultTransition DefaultTransition
LoopTransition Transition Yes
ActivityChartConditionConnector Connector Yes
TerminationState Connector Yes
JunctionConnector Connector Yes
DiagramConnector Connector Yes
JoinConnector Connector Yes
ForkConnector Connector Yes
TransitionLabel Transition Yes
Swimlane Frame Swimlane Yes
SwimlaneDivider Swimlane Yes
Dependency Dependency
ActivityPin Connector Yes
ActivityParameter Connector Yes
To re-organize the common list section of the Add New Menu for a project:
4. Click OK.
5. To confirm your change, right-click a package in your project and select Add New. Only
those values you entered in CommonList appear, as long as they are applicable to your
project.
Note the following information:
Whatever element that is removed from the common list group of the Add New menu will
appear in the middle section of the Add New menu if it is relevant for your project. The
element must appear somewhere if it is a valid element for your project.
If the AddNewMenuStructure property is in use, that property overrides the properties
mentioned here. See Customizing the Add New menu completely.
If you want to use this Add New menu customization in other projects (without having to
manually change the property for each of them), see Re-using property changes to the Add
New menu.
See also Re-organizing the bottom section of the Add New menu.
To re-organize the Add New menu, use the following properties in General::Model:
SubmenuList
Submenu1List
Submenu1Name
Submenu2List
Submenu2Name
Submenu3List
Submenu3Name
Submenu4List
Submenu4Name
A definition for each property displays on the Properties tab of the Features window.
The following example shows how you could re-organize the groups and their elements located at
the bottom of the Add New menu. In this scenario, you want to show only the activity diagram,
flowchart, and panel diagram in the Diagrams group of the Add New menu for your project. In
addition, you want to remove the Table\Matrix group.
Note: This example assumes that the properties mentioned in this topic have the
default values.
1. Open your project in Rational Rhapsody.
5. Click OK.
6. Locate General::Model::SubmenuList.
This property controls what submenu groups appear at the bottom of the Add New menu.
7. Delete Submenu3 from the values entered for the SubmenuList property.
Submenu3 specifies the Table\Matrix submenu that can appear on the Add New menu.
8. To confirm your changes, right-click a package in your project and select Add New. Only
those diagram types you entered in Submenu1List appear, as long as they are applicable
to your project. Meaning, if a flowchart is not applicable to your project, that choice will
not appear on the Add New menu under the Diagrams category. In addition, the
Table\Matrix submenu item no longer displays on the Add New menu.
Whatever element that is removed from a group from the bottom of the Add New menu
will appear in the middle section of the Add New menu if it is relevant for your project.
When you remove a group, all the elements in that group will appear in the middle section
of the Add New menu. Elements must appear somewhere if they are valid elements for
your project.
The Submenu1List and Submenu1Name properties are also used by Tools > Diagrams.
When you make a change to Submenu1List, to have it take effect on Tools > Diagrams,
you must save your project, close it, and then open it again. In addition, if you delete the
Submenu1 value from the SubmenuList property, all the Rational Rhapsody diagram
choices will appear in the Tools menu, instead of under Tools > Diagrams (after you save
your project and open it again).
If the AddNewMenuStructure property is in use, that property overrides the properties
mentioned in this topic. See Customizing the Add New menu completely.
If you want to use this Add New menu customization in other projects (without having to
manually change the properties for each of them), see Re-using property changes to the
Add New menu.
See also Re-organizing the common list section of the Add New menu.
To completely customize the choices that appear in the Add New menu for your project:
5. To confirm your changes, right-click a package in your project and select Add New. Only
those elements you entered in AddNewMenuStructure appear on the Add New menu, as
long as they are applicable to your project.
Note: If you want to use this Add New menu customization in other projects (without
having to manually change the property for each of them), see Re-using
property changes to the Add New menu.
Compare with Re-organizing the common list section of the Add New menu and Re-organizing the
bottom section of the Add New menu.
2. Create a profile for the project. Right-click the project name, select Add New > Profile
and name it (for example, MyProfile).
3. Create a stereotype for the profile. Right-click the profile and select Add New >
Stereotype and name it the same as the profile.
If you name this stereotype the same name as the profile (in this example, MyProfile,
Rational Rhapsody will auto-apply the stereotype to a project when you use the profile.
– Click the New Term check box to make this a New Term stereotype for this
profile.
– From the Applicable to drop-down list, select the Project check box to make
this New Term stereotype applicable to a project.
b. On the Properties tab, set the elements you want to appear for the Add New menu
through the use of the following properties:
5. Set the stereotype for the project (in this example, Project2) to the New Term stereotype
(in this example, MyProfile).
b. On the General tab, in the Stereotype drop-down list, select the check box for
stereotype (in this example, MyProfile).
c. Click OK.
6. To confirm your changes, right-click a package in your project and select Add New. Only
those elements you entered in the CommonList property and/or SubmenuList,
Submenu#List, and Submenu#Name properties, or AddNewMenuStructure appear, as long
as they are applicable to your project.
7. Make a corresponding text file for your custom profile and give it the same name but with
the .txt extension. Add a description for the profile. The content of the text files displays
on the description area of the New Project window.
For example, if your customized profile is MyProfile.sbs, create a MyProfile.txt file.
8. Copy the .sbs file for the profile and the corresponding .txt file to <Rational Rhapsody
installation path>\Share\Profiles\<customized profiles foldername>. For
example, you would place a copy of the MyProfile.sbs and MyProfile.txt files in, for
example, C:\Rhapsody\Share\Profiles\CustomProfiles.
If you have packages under your profile, choose to not make each package its own
separate unit so that you can keep the entire profile in a single .sbs file. Right-click the
package, select Unit > Edit Unit, and clear the Store in separate file check box on the
Unit Information window that opens).
9. To use the custom profile, when you create a new project, select the profile from the
Project Type drop-down list of the New Project window.
The capabilities added via plug-ins can be accessed through customized menu items integrated
into the out-of-the-box menus in Rational Rhapsody. Plug-ins can also provide capabilities that are
not opened directly by the user via the GUI, but rather are triggered by specific Rational Rhapsody
events, such as model checking or code generation. Plug-ins can respond to any of the events
defined in the Rational Rhapsody Callback API.
2. Create a .hep file that contains the information that Rational Rhapsody requires to load the
plug-in, or add this information to an existing .hep file if you have already created one.
In terms of writing the Java code for your plug-in, you should:
From the Eclipse main menu, select File > New > Project > Java Project.
1. In the Package Explorer View, right-click the project you created, and then select Build
Path > Configure Build Path.
1. In the Package Explorer View, right-click the project, and then select New > Class
2. When the New Java Class window is displayed, give the class a name, enter
RPUserPlugin for the Superclass, and make sure the Inherited abstract methods check
box is selected.
//called when the plug-in's menu item under the "Tools" menu is selected
public void RhpPluginInvokeItem();
//called when the project is closed - if true is returned, the plug-in will be
unloaded
public boolean RhpPluginCleanup();
helpers
plug-ins
plug-in commands
While these items differ from one another, they use the same .hep file entries to provide Rational
Rhapsody with the required information.
Helpers are also used to extend the capabilities in Rational Rhapsody, but they use a different
mechanism than plug-ins. Helpers are basically stand-alone applications. Plug-ins, on the other
hand, are not stand-alone applications. They just use the Rational Rhapsody callback mechanism
to respond to Rational Rhapsody events.
Plug-in commands don't really add any functionality of their own; they just describe context menu
items that Rational Rhapsody should add to allow you to open a certain plug-in.
For plug-ins, the .hep file must contain the following information:
Note
The .hep file must contain a [Helpers] section because the helper recognition mechanism
is the same one used when you include helper definitions in your rhapsody.ini file, which
has other sections as well. Since plug-ins are usually designed for use by groups of users, in
most cases it does not make sense to include the plug-in definition information in the
rhapsody.ini file, which is unique to each user.
numberOfElements=2
Number of plug-ins/helpers described in the file
name1=Diagram Formatter
The name that will appear on the Tools menu (if isVisible is set to 1)
JavaMainClass1=JavaPlugin.PluginMainClass
The Java class containing the plug-in code
JavaClassPath1=$OMROOT\..\Samples\JavaAPI Samples\Plug-in
Path for locating the java classes required by the plug-in. Keep in mind that if .jar files are
used, the classpath should include the names of the .jar files.
isPlugin1=1
Indicates the item is a plug-in (as opposed to a helper, which is the default, or a "plug-in
command")
isVisible1=1
Indicates that the name should be displayed in the Tools menu.
Then name of the plug-in that will be opened by this context menu item
applicableTo2=ObjectModelDiagram
Indicates the context to which the menu will be added. In this case, when you right-click an
OMD in the browser, you will see the option "Format Diagram".
isVisible2=1
Indicates that the menu item should be displayed
If you would like to see another sample .hep file, take a look at the .hep file for the plug-in sample
included with <Rational Rhapsody installation path>\Samples\ExtensibilitySamples\
Simple Plug-in\SimplePluginProfile.hep).
Give the .hep file the same name as the profile, and place it in the same directory as the
profile's .sbs file
Indicate the path to the .hep file in the value of the property
General::Profile::AdditionalHelpersFiles for the profile
In the log file, you might encounter the following common errors:
Once you have included such a main operation, you can run Rational Rhapsody and debug the
plug-in as you would any other Java application.
1. Add the following debug options to the JVM section of the rhapsody.ini file:
[JVM]
Options=ClassPath,LibPath,Debug1,Debug2,Debug3
Debug1=-Xnoagent
Debug2=-Xdebug
Debug3=-Xrunjdwp:transport=dt_socket,address=6743,server=y,suspend=y
2. Open your Java plug-in project in Eclipse and create a Remote Java Application
configuration as follows:
c. Set the port number to 6743 or any other number that you entered for "address" in the
JVM settings in the rhapsody.ini file.
3. Open Rational Rhapsody and open the project that loads your plug-in. Once the project is
loaded, Rational Rhapsody will wait until you start the debug session.
To see the capabilities that this sample plug-in adds to Rational Rhapsody, add
SimplePluginProfile.sbs to a Rational Rhapsody model "As Reference".
This profile will load the plug-in and a message will be displayed indicating the Rational
Rhapsody build number you are using.
SimplePlugin under the Tools menu - when you select this menu item, Rational Rhapsody
displays properties that were overridden in the project.
Invoke SimplePlugin For OMD, Invoke SimplePlugin For Class, and Invoke
SimplePlugin For Package, for the context menus for OMDs, classes, and packages,
respectively. Selecting these context menu items will display the element's name.
In addition, the plug-in causes messages to be displayed at the following points: before code
generation, before project save, after project save, before check model.
Use case diagrams (UCDs) model relationships between one or more users (actors) and a system
or class (classifier). You use them to specify requirements for system behavior. In addition,
Rational Rhapsody UCDs depict generalization relationships between use cases as defined in the
UML (see Creating generalizations). Rational Rhapsody does not generate code for UCDs.
System Boundary
Generalization
Association
As with other Rational Rhapsody elements, use the Features window for the diagram to edit its
features, including the name, stereotype, and description. For more information, see The Features
window.
Drawing
Button Name Description
Tool
Use Case Draws a representation of a user-visible function. A use case can be large or small,
but it must capture an important goal of a user for the system.
Actor Represents users of the system or external elements that either provide information
to the system or use information provided by the system.
Package Groups systems or parts of a system into logical components.
Generalization Shows how one use case is derived from another. The arrow head points to the
parent use case.
Dependency Defines dependencies between an actor and a use case, between two actors, or
between two use cases.
Boundary box Delineates the design scope for the system and its external actors with the use
cases inside the system boundary and the actors outside.
Flow Provides a mechanism for specifying exchange of information between system
elements at a high level of abstraction. This functionality enables you to describe the
flow of data and commands within a system at a very early stage, before committing
to a specific design. As the system specification evolves, you can refine the
abstraction to relate to the concrete implementation.
2. Click once in the drawing area. Rational Rhapsody creates a boundary box named System
Boundary Box. Alternatively, click-and-drag with the mouse to draw the system boundary
box.
Use cases
Use cases represent the externally visible behaviors, or functional aspects, of the system. They
consist of the abstract, uninterpreted interactions of the system with external entities. This means
that the content of use cases is not used for code generation. A use case is displayed in a UCD as
an oval containing a name.
The new use case is displayed in both the UCD and the browser. The browser icon for a use case is
an oval.
Name allows you to replace the default name with the name you want for this use case.
L specifies the label for the element, if any. For information on creating labels, see
Descriptive labels for elements.
Stereotype specifies the stereotype of the use case, if any. They are enclosed in guillemets,
for example «s1» and enable you to tag classes for documentation purposes. For
information on creating stereotypes, see Stereotypes.
Note that the COM stereotypes are constructive; that is, they affect code generation.
Default Package specifies a group for this use case.
2. Right-click the use case, and then select New Attribute. The Attribute window opens.
Use the L button next to the name field to assign a logical label. For more information on
labels, see Descriptive labels for elements.
4. Select the Type, Visibility, and Multiplicity for the attribute.
6. Click OK.
2. Click-and-drag the attribute to the use case in the browser. This creates a separate copy of
the attribute under the use case.
Note
If you click-and-drag an attribute from one use case to another, the attribute is moved, not
copied.
12. Type the implementation code for the operation in the Implementation text box.
Note: Code is not generated for the contents of use cases. This implementation is for
descriptive purposes only.
13. Click OK.
3. Type a name for the new extension point and click OK.
2. Right-click the use case, and then select either New Statechart or New Activity
Diagram.
For more information on these diagrams, see Statecharts and Activity diagrams.
Actors
Actors are the external entities that interact with a use case. Typical actors that operate on real-
time, embedded systems are buses (for example, Ethernet or MIB), sensors, motors, and switches.
An actor is represented as a figure in UCDs.
Actors are a kind of UML classifier similar to classes and they can participate in sequences as
instances. However, actors have the following constraints imposed on them:
Creating an actor
To create an actor:
1. Click the Actor button , and then click once in the UCD. Alternatively, click-and-drag
to draw the actor.
Name specifies the name of the element. The default name is actor_n, where n is an
incremental integer starting with 0.
L specifies the label for the element, if any. For information on creating labels, see
Descriptive labels for elements.
Stereotype specifies the stereotype of the actor, if any. They are enclosed in guillemets,
for example «s1» and enable you to tag classes for documentation purposes. For
information on creating labels, see Stereotypes.
Note: The COM stereotypes are constructive; that is, they affect code generation.
Main Diagram specifies the main diagram for the actor.
More than one UCD can contain the same use case or actor. You can select one of these
diagrams to be the main diagram for the use case or actor. This is the diagram that will
open when you select the Open Main Diagram option in the browser.
Concurrency specifies the concurrency of the actor. The possible values are as follows:
– Sequential where the element will run with other classes on a single system
thread. This means you can access this element only from one active class.
– Active where the element will start its own thread and run concurrently with
other active classes.
Defined In specifies which element owns this actor. An actor can be owned by a package,
class, or another actor.
Class Type specifies the class type. The possible values are as follows:
– Regular creates a regular class.
– Template creates a template. To specify the necessary arguments, click the
Arguments button.
– Instantiation creates an instantiation of a template.
3. Select the <New> label. A new row is displayed, with the default values filled in.
4. If needed, change the default values for the new attribute or operation.
5. Click OK.
For detailed information on creating attributes and operations, see Defining the attributes of a class.
2. Right-click the actor, and then select New Statechart, New Activity Diagram, or New
Structure Diagram.
For more information on these diagrams, see Statecharts, Activity diagrams, or Structure diagrams.
Alternatively, you can generate code for the actor by right-clicking on the actor in the UCD and
selecting Generate.
When you generate code for the configuration, code is also generated for any actors that are part of
the configuration. For detailed information on configurations, see Component configurations in the
browser.
Creating packages
Packages logically group system components. They are represented in UCDs as a file folder.
To create a package:
1. Click the Package button , and then click once in the UCD. Alternatively,
click-and-drag with the mouse to draw the package.
The new package will be displayed in both the diagram and the browser (listed under Packages).
Creating associations
Associations represent lines of communication between actors and use cases. Use cases can
associate only with actors, and vice versa.
To create an associations:
2. Click either the actor or the use case. Note that the crosshairs change to a circle with
crosshairs when you are on an element that can be part of an association.
3. Move the cursor to the target of the association and click once. If the source is an actor, the
target must be a use case, and vice versa.
The new association is displayed in both the UCD and the browser (under the actor’s
Association Ends category).
Creating generalizations
UML allows for generalization as a way of factoring out commonality between use cases. In other
words, it provides a means to derive one use case from another. Generalizations are allowed
between use cases and actors.
3. Move the cursor to the closest edge of the super-use case and click once.
Creating dependencies
A dependency is a directed relationship from a client to a supplier in which the functioning of a
client requires the presence of the supplier, but the functioning of the supplier does not require the
presence of the client. Generalizations are allowed between any two UCD elements: use case,
actor, or package.
3. Move the cursor to the closest edge of the supplier element and click once.
You can set the dependency stereotype using the Features window. See Dependencies.
Sequences
UCDs assist in the analysis phase of a project. They capture hard and firm constraints at a high
level. As design decisions are made, you further decompose UCDs to create more possible use
cases and scenarios, or sequences, that implement the use case. Each use case has a folder in the
browser containing some of its possible sequences.
Scenarios describe not only the main path through a use case, but can also include background
environmental and situational descriptions to set the stage for future events. In other words, they
can provide detailed definitions of preconditions for a use case. Therefore, a sequence describes
the main path through a use case, whereas a variant, represented by a child use case, describes
alternate paths. For example, consider a VCR. One sequence of the InstallationAndSetup use case
might be the following steps:
The specific sequence of steps through a particular use case is better expressed through a sequence
diagram. For detailed information, see Sequence diagrams.
Object model diagrams (OMDs) specify the structure and static relationships of the classes in the
system. Rational Rhapsody OMDs are both class diagrams and object diagrams, as specified in the
UML. They show the classes, objects, interfaces, and attributes in the system and the static
relationships that exist between them.
Structure diagrams focus on the objects used in the model. Although you can put classes in
structure diagrams and objects in the OMD, the toolbars for the diagrams are different to allow a
distinction between the specification of the system and its structure. For more information, see
Structure diagrams.
In this diagram, the thick sidebars on the Dishwasher class denote that it is the active class.
You can specify and edit operations and attributes directly within class and object boxes. Simply
highlight the appropriate element to make it active, then type in your changes. To open the
Features window for a given attribute or operation, just double-click the element within the
compartment.
Note
To add a new operation or attribute, press the Insert key when the appropriate compartment
is active.
Drawing
Button Name Description
Tool
Select A pointing tool to identify parts of the diagram requiring changes or additions.
Object A structural building block of a system. Objects form a cohesive unit of state (data)
and services (behavior). Every object has a public part and an private part. For more
information, see Objects.
Class Defines properties that are common to all objects of that type. For more information,
see Creating classes.
Composite A container class. You can create objects and relations inside a composite class. For
class more information, see Creating composite classes.
File Available only in Rational Rhapsody in C has an additional icon. Use it to create file
model elements. A file is a graphical representation of a header (.h) or code (.c)
source file. For more information, see Files.
Port Draws connection points among objects and their environments.
Inheritance Shows the relationship between a derived class and its parent.
Drawing
Button Name Description
Tool
Association Creates connections that are necessary for interaction such as messages.
Directed Indicates the only object that can send messages to another object. For more
association information, see Directed associations.
Aggregation Specifies an association between an aggregate (whole) and a component part. For
more information, see Aggregation associations.
Composition Defines a class that contains another part class. For more information, see
Composition associations.
Link Creates an association between the base classes of two different objects. For more
information, see Links.
Dependency Creates a relationship in which the proper functioning of one element requires
information provided by another element. For more information, see Dependencies.
Flow Specifies the flow of data and commands within a system. For more information, see
Flows and flowitems.
Realization Specifies a realization relationship between an interface and a class that implements
that interface. For more information, see Realization.
Interface Adds a set of operations that publicly define a behavior or way of handling
something so knowledge of the internals is not needed.
Actor Represents an element that is external to the system. For more information, see
Actors.
The following sections describe how to use these tools to draw the parts of an OMD. For basic
information on diagrams including how to create, open, and delete them, see Graphic editors.
Objects
Rational Rhapsody separates objects from classes in diagrams. There are two types of objects:
Objects with explicit object types specifies only the features that are relevant for the
instance. An explicit object instantiates a “normal” class from the model.
Objects with implicit types enables you to specify other features that belong to
classes, such as attributes, operations, and so on. An implicit object is a combination of
an instance and a class. Technically, the class is hidden.
Note that Rational Rhapsody in J does not support objects with implicit types.
An object is basically an instance of a class; however, you can create an object directly without
defining a class. Objects belong to packages and parts belong to structured classes; the browser
separates parts and objects into separate categories.
As with other Rational Rhapsody elements, use the Features window for the diagram to edit its
features, including the name, stereotype, and description. For more information, see The Features
window.
Creating an object
To create an object:
If you specify the name in the format <ObjectName:ClassName> (for an object with
explicit type) and the class <ClassName> exists in the model, the new object will
reference it. If it does not exist, Rational Rhapsody prompts you to create it.
Object characteristics
By default, Rational Rhapsody creates objects with implicit type. In the OMD, an object is shown
like a class box, with the following differences:
The following example shows an object model diagram that contains parts.
Object features
The Features window enables you to change the features of an object, including its concurrency
and multiplicity.
Name specifies the name of the element. The default name is object_n, where n is an
incremental integer starting with 0.
L specifies the label for the element, if any. For information on creating labels, see
Descriptive labels for elements.
Stereotype specifies the stereotype of the object, if any. They are enclosed in guillemets,
for example «s1» and enable you to tag classes for documentation purposes. For
information on creating stereotypes, see Stereotypes.
Note: The COM stereotypes are constructive; that is, they affect code generation.
Main Diagram specifies the name of the diagram of which this is a part.
Concurrency specifies the concurrency of the object. This field is available only for
objects with implicit type. The possible values are as follows:
– Sequential means the element will run with other classes on a single system
thread. This means you can access this element only from one active class.
– Active means the element will start its own thread and run concurrently with
other active classes.
Type specifies the class of which the object is an instance. To view the classes for that
class, click the Invoke Feature Dialog button next to the Type field.
In addition to the names of all the instantiated classes in the model, this list includes the
following choices:
– <Implicit> specifies an implicit object
– <Explicit> specifies an explicit object
– <New> enables you to specify a new class
– <Select> enables you to browse for a class using the selection tree
Multiplicity specifies the number of occurrences of this instance in the project. Common
values are one (1), zero or one (0,1), or one or more (1..*).
Initialization specifies the constructor being called when the object is created. If you click
the Ellipsis button, the Actual Call window opens so you can see the details of the call.
If the part does not have a constructor, with parameters, this field is dimmed.
Relation to whole enables you to name the relation for a part. If the object is part of a
composite class, enable the Knows its whole as check box and type a name for the
relation in the text box. This relation is displayed in the browser under the Association
If the Relation to whole field is specified on the General tab, the Features window
includes tabs to define that relation and its properties. However, on the tab that specifies
the features of its whole (in the illustration of the itsController tab), only the fields Name,
Label, Stereotype, and Description can be modified.
If you convert an object with implicit type to an object with explicit type (by selecting <Explicit>
in the Type field), a new class is created. By default, the name of the new class is <object
name>_class.
If you convert an object of explicit type to an object of implicit type, the following actions occur:
1. In the browser, right-click the Objects category icon and then select Edit Objects Order.
The Edit Objects declaration order window opens and lists all the files and objects in the
current package.
5. Click OK.
Note
Initial values are features of the attributes of the class, whereas instance values characterize
the specific instance of the class (that object).
For example, consider the class, Date, and an object of Date called newYear2004. The class Date
has the attributes Day, Month, and Year. The following example shows the initial values for the
class Date.
The following example shows the attributes for object newYear2004 of class Date. Note that the
Show Inherited check box specifies whether to display the inherited attributes so you can easily
modify them.
Click the Specification View icon to view the attributes and operations of an object in the OMD.
The following OMD shows the class, Date, and the object of Date called newYear2004.
In the OMD, the object values are displayed using the following format:
[visibility]<attribute name>:<attribute type>=<value>
Note the following information:
Instance values are always displayed. To hide the entire attribute, right-click the object and
select Display Options.
Both the instance and the class must be “available” in the model.
The vacuum pump removes the air from a chamber. The model needs to show the state of the
system at various points in time, the initial value, the value after one hour, and the final value.
Alternatively, you can create a new stereotype for the class («snapshot»), then set this
property to Checked.
3. In this package, each phase is represented by a different class. For the initial conditions,
create a class called InitialConditions.
4. Add a structure diagram to InitialConditions and add the elements (and their attribute
values) to the diagram.
5. To show the conditions after an hour, copy the InitialConditions class and rename it
AfterAnHour. Specify the attribute values for this stage in the process. The following
example shows the attribute values after the pump has been running for an hour.
6. To show the final values for the system, copy the InitialConditions class and rename it
FinalState. Specify the attribute values for this stage in the process. The following
example shows the final values.
7. To show the order and transitions between snapshots, you can draw a simple OMD, as
shown in the following example.
Creating classes
Classes can contain attributes, operations, event receptions, relations, components, superclasses,
types, actors, use cases, diagrams, and other classes. The browser icon for a class is a three-
compartment box with the top, or name, compartment filled in.
To create a class:
Class compartments
In the OMD, a class is shown as a rectangle with three sections, for the name, attributes, and
operations. You can select and move the line separating the attributes and operations to create
more space for either compartment.
Name
Attributes
Operations
If you shrink the box vertically, the operations and attributes sections disappear and the class
graphic shows only the class name. The attributes and operations reappear if you enlarge the
drawing.
When you rename a class in the OMD editor, the class name is changed throughout the model.
If the multiplicity is well-defined (such as 1 or 5), Rational Rhapsody creates the components at
run time, when the composite is instantiated. If an association is instantiated by a link, Rational
Rhapsody initializes the association at run time.
2. Click in the diagram, or click-and-drag to create the composite class. The new composite
class is displayed in the diagram.
Because a composite class is a container class, you can create objects and relations inside it, as
shown in this example.
A composite class uses the same Features window as objects and parts (see Class features).
Another way of having the functionality of a composite class is to use a composition. For more
information, see Composition associations.
Creating a package
In Rational Rhapsody, every class belongs to a package. Classes drawn explicitly in a package are
placed in that package in the model. Classes not drawn explicitly in a package are placed in the
default package of the diagram. If you move a class to a package, it is also placed in that package
in the model. If you do not connect this diagram to a package with the browser, Rational Rhapsody
assigns the diagram to the default package of the model.
2. Click once in the diagram. Now you must define the package using the Features window.
3. Right-click the package and select Features.
Package features
The Features window allows you to define the characteristics of a package, such as its Name or
Main Diagram.
Name specifies the name of the package. Package names cannot contain spaces or begin
with numbers.
L specifies the label for the element, if any. For information on creating labels, see
Descriptive labels for elements.
Stereotype specifies the stereotype of the package, if any. They are enclosed in guillemets,
for example «s1» and enable you to tag classes for documentation purposes. For
information on creating stereotypes, see Stereotypes.
Note that package stereotypes are not constructive (see Constructive dependencies).
Main Diagram specifies the name of the diagram of which this is a component.
The Description tab allows you to write a detailed description of the package. The Relations tab
lists all of the relationships of the package. The Tags tab lists the available tags for this package.
The Properties tab enables you to define code generation properties for the package.
Inheritance
Inheritance is the “mechanism by which more specific elements incorporate structure and behavior
of more general elements related by behavior.” Inheritance is also known as generalization, or a
“taxonomic relationship between a more general element and a more specific element. The more
specific element is fully consistent with the more general element and contains additional
information. An instance of the more specific element may be used where the more general
element is allowed.” (Both references are from the UML Specification, v1.3.)
3. Move the cursor to the superclass and click once to end the arrow.
An inheritance arrows points from the subclass to the superclass, with a large arrowhead on the
superclass end.
1. Right-click a class and then select Add New > SuperClass. The Add Superclass window
opens.
3. Click OK.
To generate an #include of the superclass header file in the subclass, do one of the following
actions:
4. Exclude the javax package from the component (do not make it one of the selected
elements in the browser). This prevents the component from generating code for anything
in the javax package.
This gives the rest of the model the ability to reference the JTree class without generating code for
it. In this way, a class in the model (for example, MyJTree) can inherit from javax.swing.JTree.
If the subclass is public, the generated code is as follows:
import javax.swing.JTree;
...
public class MyJTree extends JTree {
...
}
If you need a class to import an entire package instead of a specific class, add a dependency (see
Dependencies) with a stereotype of «Usage» to the external package, in this case javax.swing.
The generated file will then include the following line:
import javax.swing.*
For more information on using external elements, see External elements.
Realization
Rational Rhapsody allows you to specify a realization relationship between an interface and a class
that implements that interface. This type of relationship is specified using the realization connector
in the Diagram Tools for object model diagrams.
Note
Realization is a "new term" based on the generalization element. This means that it is also
possible to right-click a generalization element in a diagram and then select Change To >
Realization.
The realization connector only serves a visual purpose when used in an object model diagram. The
code generation for realization relationships is not determined by the connector used between the
class and the interface, but by the application of the interface stereotype to the class element in the
diagram that represents the interface.
If you apply the interface stereotype to a class element, then the appropriate code will be generated
for the interface and the implementing classes in Rational Rhapsody in Java and Rational
Rhapsody in C.
For details regarding the code generation for realization relationships in C, see Components-based
Development in C.
Associations
In previous versions of Rational Rhapsody, the term “relations” referred to all the different kinds
of associations. Note that the term “relations” refers to all the relationships you can define between
elements in the model (not just classes), associations, dependencies, generalization, flows, and
links.
Associations are links that allow related objects to communicate. Rational Rhapsody supports the
following types of associations:
Bi-directional association where both objects can send messages back and forth. This is
also called a symmetric association. For more information, see Bi-directional associations.
Directed association where only one of the objects can send messages to the other. For
more information, see Directed associations.
Aggregation association defines a whole-part relationship. For more information, see
Aggregation associations.
Composition aggregation defines a relationship where one class fully contains the other.
For more information, see Composition associations.
Bi-directional associations
Bi-directional (or symmetric) associations are the simplest way that two classes can relate to each
other. A bi-directional association is shown as a line between two classes, and can contain control
points. The classes can be any mix of classes, simple classes, or composite classes.
When you create an association or an aggregation association between two classes and give it a
role name that already exists, you have created another view of an existing relation.
In previous versions of Rational Rhapsody, an association was described by one or two association
ends. An association can be composed of the following elements:
Note
If you draw an anchor from a class to a relation (association, aggregation, or composition),
it semantically implies that the class is an association class for this relation. Removing the
icon changes the association class into a regular class.
2. Click in a class.
In this example note the bi-directional Association line between two classes.
Associations specify how classes relate to each other with role names. The relative
numbers of objects participating is shown with multiplicity.
You can move an association name freely.
If you remove the class at one end of an association from the view, the association is also
removed from the view. If you delete a class at one end of an association from the model,
the association is also deleted.
The role names and multiplicity are set in the Features window for the association. To edit
a role name or multiplicity, double-click it.
If you move an association line from between class x and class y to between class x and
class z, where z is a subclass of y, it is removed from y. But if z is a superclass of y, it
remains because all relationships with a superclass are shared by their subclasses. If z and
y are independent, Rational Rhapsody moves it from y to z.
Association features
The Features window enables you to change the features of an association, such as what it consists
of (for example, two ends or a single end) and its association ends. The following figure shows the
Features window for a bi-directional association.
Using this group box, you can change the role name of each enabled end. An enabled end
is an end that is part of the specification of the association. The label under this field
contains the type of the association end (the class to which the end is connected), the
navigability of the end, and its aggregation kind. For a non-existing end, this label
contains only “Role of.”
Description describes the association. This field can include a hyperlink. For more
information, see Hyperlinks.
Note
If the association class or element does not exist, the Name, Stereotype, Label, and
Description fields are disabled.
In addition to the General tab, the Features window for an association contains the following tabs:
End1 or End2
End1 properties or End2 properties
If the Consists of field is set to Association Class, the window also includes tabs for attributes and
operations, as shown in this example.
Qualifier shows the attributes in the related class that could function as qualifiers.
A qualifier is an attribute that can be used to distinguish one object from another. For
example, a PIN number can serve as a qualifier on a BankCard class. If a class is
associated with many objects of another class, you can select a qualifier to differentiate
individual objects. The qualifier becomes an index into the multiple relation. Adding a
qualifier makes the relation a qualified association.
Aggregation Kind specifies the type of aggregation. The possible values are as follows:
– None means no aggregation.
– Shared (empty diamond)\ means shared aggregation (whole/part
relationship).
– Composition (filled diamond) means composition relationship. The instances
of the class at this end contains instances of the class at the other end as a part.
This part cannot be contained by other instances.
Navigable specifies whether the association allows access to the other class. Both ends of
a bi-directional association are navigable. In a directed association, the element that has
the arrow head is navigable; the other end is not. For more information, see Directed
associations.
Note that if an end is read only, its feature fields are also read-only.
Directed associations
In a directed (or one-way) association, only one of the objects can send messages to the other. It is
shown with an arrow, as shown in this example.
The Features window for a directed association is the same as the Features window for a
bi-directional association (see Association features), but the available tabs are different. As shown
in the figure, a directed association has one role name and one multiplicity.
If the directed association is not named (as shown in the figure), the Consists of field is set to End
<X> and the window contains only the tabs General, End1, and End1 properties.
However, for a named directed association, the Consists of field of the Features window is set to
Association Element, which means there is one more non-navigable end. The window contains
the following additional tabs:
Association Tags specifies the tags that can be applied to this association. For more
information on tags, see Profiles.
Association properties specifies the properties that affect this association.
Aggregation associations
Associations and aggregation associations are similar in usage. An association portrays a general
relationship between two classes; an aggregation association shows a whole-part relationship.
When you create an association or an aggregation association between two classes and give it a
role name that already exists, you have created another view of the existing association.
An aggregation association is shown as a line with a diamond on one end. The side with the
diamond indicates the whole class, whereas the side with the line is the part class. In the following
sample Aggregation Association, the diamond is placed at the first point of the aggregation:
Composition associations
Another way of drawing a composite class is to use a composition association. A composition
association is a strong aggregation relation connecting a composite class to a part class
(component). The notation is a solid diamond at the composite end of the of the relationship, as
shown in this example.
The composite class has the sole responsibility of memory management for its part classes. As a
result, a part class can be included in only one composite class at a time. A composition can
contain both classes and associations.
Associations implementation
Rational Rhapsody implements associations using containers. Containers are objects that store
collections of other objects. To properly generate code for associations, you must specify the
container set and type within that set you are using for the association.
Generally, you use the same container set for all associations. You specify the container set using
the CG::Configuration::ContainerSet property. There are many options, depending on the
language you are using. You can assign various container types, as defined in the selected
container set, to specific relations. Container types include Fixed, StaticArray,
BoundedOrdered, BoundedUnordered, UnboundedOrdered, UnboundedUnordered, and
Qualified, among others. In addition, you can define your own container type called User. You
specify the container type using the Implementation and ImplementWithStaticArray properties
(under CG::Relation).
Associations menu
In addition to the common operations (see Edit elements), the menu for associations includes the
following options:
Select Association lists the available associations for this class, as shown in this example.
This functionality is useful when you have more than one association between the same
elements.
Select associations
In OMDs, you can select associations for classes that have more than one association defined
between the same two classes. To do this, hold down the right mouse button over an association
line to bring up the menu, then select Select Association.
Links
A link is an instance of an association. In previous releases of Rational Rhapsody, you could link
objects in the model only if there were an explicit relationship between their corresponding
classes. An association line between two objects meant the existence of two different model
elements:
Specify links without having to specify the association being instantiated by the link.
Specify features of links that are not mapped to an association.
In addition, Rational Rhapsody supports links across packages, including code generation. To
support this functionality, the default value of the property
CG::Component::InitializationScheme was changed to ByComponent.
Creating a link
To create a link, there must be at least one association that connects one of the base classes of the
type of one of the objects to a base class of the type of the second object.
To create a link:
The new link is created in the diagram, and is displayed in the browser under the Link category.
Note that you can drag-and-drop links in the browser to other classes and packages as needed;
however, you cannot create links in the browser.
The following figure shows links in an OMD. Note that links shown in dark green to distinguish
them from associations, which are drawn in red. In addition, the names and multiplicity of links
are underlined.
By default, the role name and multiplicity of a link are not displayed. Right-click the link and
select Display Options to select the items you want to display. For more information, see Link
menu.
Links can be drawn between two objects or ports that belong to objects. One exception is
the case when a link is drawn between a port that belongs to a composite class and its part
(or a port of its part).
When drawing a link, Rational Rhapsody finds the association that can be instantiated by
the newly drawn link and automatically maps the link to instantiate the association.
If you draw a link between two objects with implicit type and there no associations to
instantiate, Rational Rhapsody automatically creates a new, symmetric association.
Link features
The Features window enables you to change the features of a link, such as the association being
instantiated by the link.
Rational Rhapsody allows you to specify a link without having to specify the association
being instantiated by the link. Until you specify the association, this field is set to
<Unspecified>.
If you select <New> from the list, Rational Rhapsody creates a new, symmetric
association based on the data (its name and multiplicity) for the link. Note that once you
specify an association for the link, you cannot change the role name or multiplicity for the
link (the corresponding fields of the Features window are unavailable).
To change the features of an association of which the link is an instantiation, you must
open the Features window of the association itself. Any changes you make to the
association are instantly applied to links that are instantiated from it.
End1 and End2 specifies the two ends of the link, including:
– Name means the name of the link.
– Multiplicity means the multiplicity of the link.
– Via Port means the port used by the link, if any. This is a read-only field.
Description describes the element. This field can include a hyperlink. For more
information, see Hyperlinks.
Link menu
In addition to the common operations (see Edit elements), the menu for links includes the
following options:
When you right-click a link, the menu contains the following options:
Select Link lists the available links in the model. For more information, see Referencing
links.
Select Association to instantiate lists the associations available in the model so you can
easily select one for the link to instantiate. For more information, see Mapping a link to an
association.
Show Labels specifies whether to display element labels in the diagram.
Note that if you select this option and the link instantiates an association, the link ends
will use the labels instead of the role names of the corresponding association ends.
Display Options determines whether the names and multiplicities of link ends are
displayed. For more information, see Displaying links.
Referencing links
To map a link line to an existing link in the model, right-click the link and select Select Link, as
shown in this example. This functionality is very useful when you have more than one link
between the same elements.
To change the association, simply select a different association from the submenu. If you do this
and the Active Code View is active, the corresponding code updates to reflect the change.
Displaying links
By default, the names and multiplicities of link ends are not displayed. To change the display,
right-click the link and select Display Options.
Note
Although the Link Name field is available by default, the “generated” link name is not
shown on the diagram. However, if you change the name of the link, the new name will be
displayed in the diagram.
Enable (check) the fields you want displayed in the diagram.
Completing relations
between these Results in...
elements...
Two classes Rational Rhapsody draws the
associations, generalizations, and
dependencies but not the links.
Two objects with implicit type Rational Rhapsody draws the
associations, generalizations,
dependencies, and links. If the link
instantiates an association, the link
is drawn, but the association is not.
Two objects with explicit type Rational Rhapsody draws only the
links.
For more information in the Complete Relations functionality, see Complete relations.
If the objects are parts of a composite, the link is owned by the composite. When the
objects are global, the link is owned by a package. Links across packages are initialized
by the component.
The package and objects for the link are in the scope of the generated component.
The CG::Component::InitializationScheme property for the component is set to
ByComponent for links across packages.
If more than one link exists between two objects over the same relation, Rational
Rhapsody arbitrarily chooses which link to instantiate. The packages that contain the
objects are given priority in this decision.
You can populate a one-to-many container by creating the objects in source code and adding them
to the container. However, you cannot model a generic one-to-many relationship and populate it
with an unknown number of diagrammatically modeled objects. Therefore, it is not possible to
populate a one-to-many relationship between classes drawn in one OMD with objects drawn in
another OMD.
Restrictions
Note the following limitations and restrictions:
Dependencies
A dependency exists when the implementation or functioning of one element (class or package)
requires the presence of another element. For example, if class C has an attribute a that is of class
D, there is a dependency from C to D.
In the UML, a dependency is a directed relationship from a client (or clients) to a supplier stating
that the client is dependent on, and affected by, the supplier. In other words, the client element
requires the presence and knowledge of the supplier element. The supplier element is independent
of, and unaffected by, the client element.
Dependency arrows
A dependency arrow is a dotted line with an arrow. You can draw a dependency arrow between
elements, or you can have one end attached and the other free. It can have a label, which you can
move freely. If a dependency arrow is drawn to or from an element, it is attached to the element;
the attached end moves with the attached border of the element.
3. Click the object on which it depends. This object also known as the provider.
Note that you can create more than one dependency between the same two elements. For example,
if you create one dependency from element X to element Y, the default name of the dependency is Y.
If you create a second dependency between the same two elements, the second dependency is
named Y_0 by default. To rename a dependency, do one of the following actions:
Open the Features window for the dependency, and type the new name in the Name field.
In the browser, left-click the dependency whose name you want to change, and type the
new name in the text box.
1. In the browser, right-click the element that depends on another element and then select
Add New > Dependency. The Add Dependency window opens.
2. Use the list to select the element on which the specified element depends.
Click the <<Select>> line to open a browsable tree of the entire project, as shown in
the following example.
Dependency features
The Features window enables you to change the features of a dependency, including its name and
stereotype.
Dependency menu
In addition to the common operations (see Edit elements), the menu for dependencies includes the
following options:
Display Options specifies how dependencies are displayed. The following figure shows
the display options for dependencies.
Select Dependency enables you to select a dependency. This functionality is useful when
you have more than one dependency between the same elements.
Constructive dependencies
Rational Rhapsody supports the dependency stereotypes «Send», «Usage», and «Friend».
Note
If a class has a dependency on another class that is outside the scope of the component,
Rational Rhapsody does not automatically generate an #include statement for the external
class. You must set the «Usage» stereotype and the <lang>_CG::Class::SpecInclude
property for the dependent class.
Stereotypes are shown between guillemets («..») and are attached to the dependency line in the
OMD, as shown in this example.
The Properties tab in the Features window enables you to define the UsageType property for the
dependency. This property determines how code is generated for dependencies to which a «Usage»
stereotype is attached. The possible values for the UsageType property are as follows:
Actors
An actor is a “coherent set of roles that users of use cases play when interacting with these use
cases. An actor has one role for each use case with which it communicates.” (UML specification,
version 1.3) An actor is a type of class with limited behavior. As such, it can be shown in an OMD.
Creating an actor
To create an actor:
For a detailed explanation of actors, see Actors. Note that an actor has a Features window that is
very similar to that of a class; for more information about the Features window Creating classes.
Flows can convey flowitems, classes, types, events, attributes and variables, parts and objects, and
relations. You can draw flows between the following elements:
Actors
Classes
Components
Nodes
Objects
Packages
Parts
Ports
Use cases
You can add flows to all of the static diagrams supported by Rational Rhapsody.
The flows in this object model diagram show the black-box representation of an air conditioning
unit and the actors that interact with it. It includes the information that is passed either from an
actor to the AC unit or from the AC unit to an actor.
Creating a flow
Every static diagram toolbar includes an Flow tool, which is drawn like a link. Static (or
structural) diagrams include object model diagrams, structure diagrams, use case diagrams,
component diagrams, and deployment diagrams.
To create a flow:
1. In the Diagram Tools, click the Flow icon or choose Edit > Add New > Relations
> Flow.
Note: Add New > Relations is the default menu command structure in Rational
Rhapsody. It can be changed by users. This topic assumes that all defaults are
in place.
2. In the diagram, click near the first object to anchor the flow.
4. In the edit box, type the element conveyed by the flow, then press Enter.
By default, a flow is displayed as a green, dashed arrow with the keyword «flow» underneath it.
To suppress the «flow» keyword, open the Display Options window and disable the <<flow>>
keyword check box. You can also control the display of the <<flow>> keyword for new flows by
setting the <Static diagram>::Flow::flowKeyword Boolean property.
The flows and flowitems are both displayed in the browser, as shown in the following example.
Features of a flow
The Features window enables you to change the features a flow, such as its name or flow ends. A
flow has the following features:
Name specifies the name of the flow. By default, the flow is named using the following
convention:
<source>_<target>[_###]
In this convention, the source and target are end1 and end2 of the flow, based on the
direction (end1 is the source in bidirectional flows as well as flows from end1 to end2);
_### specifies additional numbering when the name is already used.
L specifies the label for the element, if any. For information on creating labels, see
Descriptive labels for elements.
Stereotype specifies the stereotype of the flow, if any. They are enclosed in guillemets, for
example «s1» and enable you to tag classes for documentation purposes. For information
on creating stereotypes, see Stereotypes.
Note: The COM stereotypes are constructive; that is, they affect code generation.
Flow Ends specifies how the information travels, from the source (End1) to the target
(End2). To change either end, use the pull-down list to select a new source or target from
the selection tree.
Direction specifies the direction in which the information flows. To invert the flow, or to
make it bidirectional, use the appropriate value from the
pull-down list.
Description describes the flow. This field can include a hyperlink. For more information,
see Hyperlinks.
Conveyed information
All the information elements that are conveyed on the flow are listed on the Flow Items tab, as
shown in this example.
An information element can be any Flowitem, as well as elements that can realize a flowitem
(classes, events, types, attributes and variables, parts and objects, and relations).
This tab enables you to perform the following tasks on information elements:
Note that you can specify multiple information elements using a comma-separated list. For
example, in the OMD the flow from the AC unit to the Display actor contains two information
elements: the DisplayInfo flowitem and the evStateChg event. The following figure shows the
corresponding Flow Items tab.
Flow menu
In addition to the common operations (see Edit elements), the menu for flows includes the
following options:
Display Options opens the Display options window for the flow.
Select Information Flow provides a list of the flows already defined between these ends
so you can easily reuse flows in your model.
Flowitems
A flowitem is an abstraction of all kinds of information that can be exchanged between objects. It
does not specify the structure, type, or nature of the represented data. You provide details about the
information being passed by defining the classifiers that are represented by the flowitem.
Flowitems can be decomposed into more specific flowitems. This enables you to start in a very
high level of abstraction and gradually refine it by representing the flowitem with more specific
items.
A flowitem can represent either pure data, data instantiation, or commands (events). Flowitems
can represent the following elements:
Classes
Types
Events
Other information items
Attributes and variables
Parts and objects
Relations
Flowitem features
To view the features of a particular information element, double-click the element in the list on the
Flow Items tab for the flow. The corresponding Features window opens.
1. To create a new attribute, either click the <Add> row in the list of information elements,
or click the New icon in the upper, right corner of the window and select the appropriate
element from the list.
The new element is added to the list and its Features window automatically opens.
3. Click OK twice.
1. On the Flow Items tab for the flow, highlight the <Add> row and select the <Select>
option in the menu.
2. Expand each subcategory as needed to select the information element from the tree, then
click OK.
3. You return to the Flow Items tab, where the specified information element now displays
in the list of elements.
4. Click OK.
Embedded flows
In SysML notation, flows can be embedded in links. Rational Rhapsody allows you to use this
notation in object model diagrams.
Once the flow is created, it has the same features as an ordinary flow element, representing the
flow of data between the two objects that are linked. Visually, the flow is displayed on top of the
link, and it is depicted by an arrow.
To move the embedded flow diagram element, drag the arrow to a new position on the link.
4. Click OK.
Restrictions
Note the following restrictions and limitations:
Files
Rational Rhapsody Developer for C allows you to create model elements that represent files. A file
is a graphical representation of a specification (.h) or implementation (.c) source file. This new
model element enables you to use functional modeling and take advantage of the capabilities of
Rational Rhapsody (modeling, execution, code generation, and reverse engineering), without
radically changing the existing files.
Note
Files are not the same as the file functionality in components that existed in previous
versions of Rational Rhapsody. To differentiate between the two, the new file is called File
in Package and the old file element is called File in Component. A File in Component
includes only references to primary model elements (package, class, and object) and shows
their mapping to physical files during code generation.
A file element can include variables, functions, dependencies, types, parts, aggregate classes, and
other model elements. However, nested files are not allowed.
You can drag files onto object model diagrams and structure diagrams.
If you use the FunctionalC profile, then the File tool is available in the Diagram Tools for
object model diagrams and structure diagrams.
You can drag files onto a sequence diagram, or realize instance lines as files.
A file can have a statechart or activity diagram.
Files are implicit and always have a multiplicity of 1.
Files are listed in the component scope and the initialization tree of a configuration. They
have influence in the initialization tree only in the case of a Derived scope.
Files can be defined as separate units, and can have configuration management performed
on them. For more information, see Using project units.
Files can be owned by packages only.
Creating a file
To create a file element:
1. Click the File icon in the Diagram Tools, or select Edit > Add New > File.
2. Click, or click-and-drag, in the drawing area. By default, files are named file_n, where n
is an integer greater than or equal to 0.
The file is shown as a box-like element in the diagram, with the «File» notation in the top of the
box.
You can specify whether file variables and functions are displayed in diagrams using the Display
Options feature. The Display Options window for files is identical to that for classes, except the
tab names are Variables instead of Attributes and Functions instead of Operations. For more
information, see Display option settings.
Files can be owned by packages only. File elements are listed in the browser under the Files
category under the owning package, as shown in this example.
File features
The Features window enables you to change the features of an file, including its name, stereotype,
and main diagram. The following figure shows the Features window for a file.
The General tab for a file is very similar to that of an object (see Object features), with the
following differences:
The Type, Initialization, Multiplicity, and Relation to whole fields are unavailable.
Multiplicity has no meaning with files, because a file is simply a file (not an object that
can be instantiated). Similarly, a file cannot be an instantiation of a class (it is always
implicit).
The Path field is a read-only field that displays the path to the file. Click the icon to
navigate directly to the specified source file.
Converting files
You can easily convert a file to an object or vice versa by simply highlighting the object in the
browser, then selecting Change to and the intended result.
1. Highlight the file in the browser, right-click and then select Change to > Object. The file
changes to an object and moves to the Objects category in the browser.
2. Highlight the object in the browser, right-click and then select Expose Class. This create a
new class with the name <object> class. It contains all of the content of the copied
object including the attributes, operations, and statechart. This option is only available for
an implicit object.
If you are trying to convert an object to a file and there are aggregates that are not allowed
for files, Rational Rhapsody issues a warning message.
Objects that are owned by another class or object cannot be converted to files.
When the element has been converted, the graphical representations change in the diagrams and
the converted element is moved to the appropriate category in the browser.
For information on changing the order of files, see Editing the declaration order of objects.
Because these files are connected through bi-directional association, File1 can call doFunction()
directly from an operation or action on behavior.
For an active or a reactive file, Rational Rhapsody generates a public, implicit object (singleton)
that uses the active or reactive functionality. The name of the singleton is the name of the file.
Note
The singleton instance is defined in the implementation source file, not in the package
source file.
For a variable with a Constant modifier, Rhapsody generates a #define
statement. For example:
#define MAX 66
The following table shows the differences between code generation of an object and a file.
For example:
static int volume;
Auto-generated
Initialization and Only algorithmic initialization is done in the Any initialization is done in
cleanup initialization method (creating parts; the Init method.
initializing links, behavior, and animation). Init and Cleanup
The initialization and cleanup methods are methods are generated by
created only when needed. default.
The name of the initialization function is
<file>_Init; the cleanup function is
<file>_Cleanup.
Framework data Rational Rhapsody generates a Framework members are
members designated struct that holds only the generated as part of the
framework members, and a single object struct declaration.
instance of the struct named <file>.
The struct name is <file>_t.
For example:
struct Motor_t {
RiCReactive ric_reactive;
}
Call framework Framework operations on the file are Framework operations on
operations called using the file. the singleton are called
For example: passing the singleton
instance.
CGEN(Motor, ev());
For example:
CGEN(Motor,ev());
Statechart data Statechart data members are generated Statechart data members
members as attributes of the generated structure. are generated as part of the
For example: struct.
struct F_t {
...
enum F_Enum {
F_RiCNonState=0,
F_ready=1}
F_EnumVar;
int rootState_subState;
int rootState_active;
};
Tool Description
COM API Files are supported by the COM API via the IRPFile and
IRPModule interfaces
Complete Relation When you select Layout > Complete Relations, files and
their relations are part of the information added to the
diagram.
For more information on this functionality, see Complete
relations.
DiffMerge Files are included in difference and merge operations,
completely separate from objects.
Java API Files are supported by the Java API
Populate Diagram Files and their relations are fully supported
References If you use the References functionality for a file, the tool lists
the owning package for the file and the diagrams in which the
specified file displays. When you select a diagram from the
returned list, the file is highlighted in the diagram.
For more information on this functionality, see Searching in
the model.
Report on model In a report, the objects and files in the package are listed in
separate groups in that order.
For more information on this reporting tool, see Reports.
Search in model You can search for files in the model and select their type
from the list of possible types. When selected, the file is
highlighted in the browser.
For more information on this functionality, see Searching in
the model.
XMI Toolkit When you export a file to XMI, it is converted to an object with
a «File» stereotype. Files imported from XMI are imported
into Rational Rhapsody as files.
There might, however, be situations where you will want to show a higher level of detail and
include attributes, operations, variables, functions, or types as individual diagram elements.
Rational Rhapsody provides a solution for these situations by allowing you to drag these elements
from the browser to an OMD diagram
Note
Rational Rhapsody allows these types of elements to be dragged from the browser to any of
the static diagrams, not just object model diagrams.
When an item of this type is added to a diagram, the graphic element will display by default, the
element name, the stereotype applied (if there is one) or the metatype of the element, and the
associated image (if one has been defined).
Like all diagram elements, the Features window for these elements can be opened by double-
clicking on the element in the diagram.
The connectors provided in the Diagram Tools can be used to connect individual elements of
these types if the connection is semantically logical.
Once an element has been added to a diagram, the element can be added to a container element by
dragging the element into the container element, for example, an attribute on the diagram can be
dragged into a class.
Note
Graphic representations for these types of items can only be created by dragging them from
the browser to the diagram. There is no API equivalent for this action.
Flow ports
Flow ports allow you to represent the flow of data between objects in an object model diagram,
without defining events and operations. Flow ports can be added to objects and classes in object
model diagrams. They allow you to update an attribute in one object automatically when an
attribute of the same type in another object changes its value.
Note
Flow ports are not supported in Rational Rhapsody in J.
The method used for specifying the data that is to be sent/received via the flow port depends upon
the type of flow port used - atomic or non-atomic. Non-atomic flow ports can only be used if your
model uses the SysML profile. The following sections describe these two types of flow ports.
You specify the attribute that is to be sent/received via the flow port by giving the attribute and
flow port the same name. If no attribute name matches the name of the flow port, a warning to this
effect will be issued during code generation.
Atomic flow ports allow the flow of only a single primitive attribute.
When connecting two atomic flow ports, you have to make sure that one is an input flow port and
one is an output flow port. The type of the attribute in the sending and receiving objects must
match.
Non-atomic flow ports can transfer a list of flow properties (a flow specification), which can be
made up of flow properties of different types. For each flow property in the list, you indicate the
direction of the flow. (Non-atomic flow ports are bi-directional.)
2. Add flow properties to the flow specification. This can be done using the relevant browser
context menu, or directly on the FlowProperties tab of the Features window for the flow
specification. You can also use drag-and-drop in the browser to add existing flow
properties to the flow specification. (If you want to use an existing attribute, you can
convert the attribute to a flow property by selecting Change To > FlowProperty from the
attribute context menu.)
5. In the Features window for each of the two flow ports (the sending and receiving), set the
Type to the name of the flow specification you created previously.
6. For one of the flow ports, open the Features window and select the Reversed check box
on the General tab
When this function is called, there is also an event generated called chflowportname. In our
example, it would be chX. In order to be able to react to this event, you must define an event with
this name in your model.
For both of these functions, the first letter of the flow port name is upper-case even if the actual
name of the flow port begins with a lower-case letter.
Note
For details regarding the use of flow ports when importing Simulink models, see Integrating
Simulink components.
External elements
Rational Rhapsody enables you to visualize frozen legacy code or edit external code as external
elements. This external code is code that is developed and maintained outside of Rational
Rhapsody. This code will not be regenerated by Rational Rhapsody, but will participate in code
generation of Rational Rhapsody models that interact or interface with this external code so, for
example, the appropriate #include statement is generated. This functionality provides easy
modeling with code written outside of Rational Rhapsody, and a better understanding of a proven
system.
Reverse engineering
When creating external elements using reverse engineering, the preferred method depends on
whether the code is frozen legacy code or the code is still being modified.
3. Set your new component (created in the previous step) to be the active component
(right-click it in the Rational Rhapsody browser and select Set as Active Component).
4. Choose Tools > Reverse Engineering to open the Reverse Engineering window.
b. For Rational Rhapsody in 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. (For more
information on the available options on the Mapping tab, see Mapping classes to types
and packages.)
9. Click OK.
10. Click the Start button on the Reverse Engineering window.The specified files are
imported into Rational Rhapsody as external elements.
Note that external elements include a special icon in the upper, right corner of the
regular icon, as shown in this example.
11. Verify the import to make sure the implementation and specification files are named
correctly, the correct folders were created, and so on. Make any necessary changes.
14. Make sure that the external elements are included in the scope of the ExternalComponent
only.
1. Complete the steps in the previous procedure (see Reverse engineering) to create a new
external model (for example, ExternalModel).
4. Choose File > Add to Model, then select the external model. Select As Reference and
select all the top-most packages and the component (ExternalModel). The elements are
imported as read-only (RO).
2. Update the reverse engineering options as needed to include the code modifications (such
as including new folders), and then click Import.
3. Close the external model.
b. Update references to renamed elements from the external model (they become
unresolved).
CG::Configuration::StrictExternalElementsGeneration
CG::Component::SupportExternalElementsInScope
These properties are automatically overridden by Rational Rhapsody when you load
an older model.
5. Add relations to the external elements (for more information, see External element code
access).
2. Add a new component for the external elements (for example, ExternalComponent).
Note: This step is optional; you can also add external elements to existing packages.
5. Add the package that contains the external elements to the scope of the external
component. Make sure that the package is not included in the scope of other components.
7. Provide the following information about the source files of the external elements:
a. Create a hierarchy of packages as needed for the proper #include path. For example,
suppose you want reference class C, which is defined in
C:\MyProjects\Project1\MySubsystem\C.h; you would create the package
MySubsystem.
b. Add a file with the necessary name to the folder and map the external element to it.
You do not need to do this if the external element has the same name as the file.
c. Create a usage dependency to the external component.
8. Add relations to the external elements (for more information, see External element code
access).
In the generated files, the following #include is generated for the example element:
#include <MySubsystem\C.h>
3. Create the appropriate files (for more information, see Creating a file). Continuing the
example, you would simply create the file C.
5. Add the rest of the path to the Include Path field of the component. In the example, this
would be C:\MyProjects\Project1.
6. Set the property C_CG::Package::GenerateDirectory to Checked for the component.
1. Create a new package for the converted elements (for example, RedesignPackage).
3. Move one class or file from the external package to the RedesignPackage.
5. Repeat Steps 3 and 4 for as many classes or files as you want to convert.
In the Features window for the configuration, set the scope to Selected Elements, and verify that
the external files are not checked.
1. Add the component file that contains the mapping of the necessary external elements to
the component.
class ExternalClass;
To generate a local #include statement (for example, #include <C.h>), set the property
CG::File::IncludeScheme to LocalOnly.
To generate a relative #include statement (for example, #include <MySubsystem\C.h>), set the
CG::File::IncludeScheme to RelativeToConfiguration.
Limitations
Note the following restrictions and behavior of external elements:
External elements are not animated; they behave like the system border.
Changes in the source files of external elements are not roundtripped. If necessary, use
reverse engineering to update external elements.
Only the following elements can be external: class, implicit object or file, package, and
type. Components, folders, variables, and functions cannot be external.
You cannot use Add to Model to add an external element as a unit. However, you can add
the unit under another name, and then set that unit to be external.
There are two ways to start this functionality: implicitly and explicitly.
Implicit invocation
When you connect two classes with a generalization realization, the base classes are implemented
implicitly. However, a generalization will not trigger base class implementation in the following
cases:
Explicit invocation
To access this functionality explicitly, in the browser or OMD, right-click a class and select
Implement Base Classes.
The window contains three filters to control the contents of the tree view:
Rational Rhapsody uses the following colors to differentiate the different method types:
2. Click the Edit Code button. Rational Rhapsody displays the code in the default text editor.
Note that if you try to edit code for an operation that has already been implemented, the text editor
displays the implementation code in read-only mode.
When you edit the implementation code, Rational Rhapsody overlays a red icon in the upper, left
corner of the class icon in the tree view, as shown in this example.
For more information on the internal code editor and its properties, see The Internal code editor.
If you select this check box, Rational Rhapsody writes the following line to the [General] section
of the rhapsody.ini file:
ImplementBaseClasses=TRUE
If wanted, you can add this line directly to the rhapsody.ini file to automatically display the
window.
For example, suppose you want to implement the tune operation. In the window, select tune, then
click OK.
The PllTuner class implements the tune operation and displays it in the browser. If you select
Implement Base Classes for the PllTuner class again, the tune operation is no longer listed as a
required or optional element. Click Implemented to see that the tune operation was implemented
and is now displayed in gray, as shown in this example.
If an element has been implemented (it displays in gray in the tree and is checked), you cannot
uncheck (“unrealize”) it.
Note
If you choose Undo, Rational Rhapsody unimplements all the implemented classes, not just
the last one, because the implementation is viewed as a single, atomic operation. For
example, if you implement five elements during one operation, then select Undo, all five
are removed.
Namespace containment
Rational Rhapsody allows you to display namespace containment in object model diagrams. This
type of notation is also referred to as “alternative membership notation.” It depicts the hierarchical
relationship between elements and the element that contains them, for example:
The default value of the property is Cleared. However, in the SysML profile the default value of
the property is Checked.
1. Drag the “container” element and the “contained” elements to the diagram.
2. From the menu, select Layout > Complete Relations > All
The hierarchical relationship between the elements will be depicted in the diagram.
Alternatively, you can select the Populate Diagram check box when creating a new diagram. If
you then select elements that have a hierarchical relationship, the diagram created will display the
namespace containment for the elements.
Note
There is no drawing tool to manually draw this type of relationship on the canvas.
Containment relationships between elements can only be displayed automatically based on
existing relationships, using one of the methods described above.
Activity diagrams specify a workflow, or process, for classes, use cases, and operations. As
opposed to statecharts, activity diagrams are preferable when behavior is not event driven. A class
(use case/operation) can have either an activity diagram or a statechart, but not both. However, a
class, object, or use case might have more than one activity diagram with one of the diagrams
designated as the main behavior.
Note
It is possible to change the main behavior between different activities within the same
classifier.
Note
Sequence diagrams can show algorithms of execution within objects, but activity diagrams
are more useful for this purpose because they are better at showing concurrency.
Activity diagrams have several elements in common with statecharts, including start and end
activities, forks, joins, guards, and states (called actions). Unlike statecharts, activity diagrams
have the following elements:
Decision points show branching points in the program flow based on guard conditions.
Actions represent function invocations with a single exit activity flow taken when the
function completes. It is not necessary for all actions to be within the same object.
Action blocks represent compound actions that can be decomposed into actions.
Subactivities represent nested activity diagrams.
Object nodes represents an object passed from the output of the action for one state to the
input of the actions for another state.
Swimlanes visually organize responsibility for actions and subactions. They often
correspond to organizational units in a business model.
Create Adding call behaviors in the activity diagram or by dropping an operation from the
browser into the diagram
Swimlane association (representing field population) to a class (only) can be created by
dragging the class from the browser to the Swimlane name compartment. For more
information, see Swimlanes.
Reference an alternate activity diagram within the main behavior activity diagram
Actions
Activity diagrams are flowcharts that decompose a system into activities that correspond to states.
These diagrammatic elements, called actions, are member function calls within a given operation.
In contrast to normal states (as in statecharts), actions in activity diagrams terminate on completion
of the activity, rather than as a reaction to an externally generated event.
Each action can have an entry action, and must have at least one outgoing activity flow. The
implicit event trigger on the outgoing activity flow is the completion of the entry action. If the
action has several outgoing transitions, each must have its own guard condition.
Outgoing transitions from actions do not include an event signature. They can include
guard conditions and actions.
Actions have non-empty entry actions.
Actions do not have internal transitions or exit actions, nor do activities.
Outgoing transitions on actions have no triggering events.
Drawing
Icon Name Description
Tool
Accept Event Adds this element to an activity diagram so that you can connect it to an action to
Action show the resulting action for an event. This element can specify the following
actions:
• Event to send
• Event target
• Values for event arguments
This button displays on Diagram Tools when you select the Analysis Only check
box when you define the General features of the activity diagram.
Accept Time Adds an element that denotes the time elapsed since the current state was entered.
Event
Action Shows member function calls within a given operation.
Action Block Represents compound actions that can be decomposed into actions. Action blocks
can show more detail than is possible in a single, top-level action
Action Pin Adds an element to represent the inputs and outputs for the relevant action or action
block. An action pin can be used on a Call Operation (derived from the arguments).
This button displays in on Diagram Tools when you select the Analysis Only check
box when defining the general features of the activity diagram. For more information,
see Add action pins/activity parameters to diagrams.
Activity Final Signifies either local or global termination, depending on where they are placed in
the diagram.
Activity Flow Add or modify a text describing a transition.
Label
Activity Defines a characteristic of an action block. This button displays on Diagram Tools
Parameter when you select the Analysis Only check box when defining the general features of
the activity diagram. For more information, see Add action pins/activity
parameters to diagrams.
Call Behavior Represents a call to an operation of a classifier. This is only used in modeling and
does not generate code for the call operation.
Call Operation Represents a call to an operation of a classifier.
Drawing
Icon Name Description
Tool
ControlFlow Represents a message or event that causes an object to transition from one state to
another.
Decision Node Shows a branching condition. A decision node can have only one incoming transition
and two or more outgoing transitions.
Dependency Indicates a dependent relationship between two items in the diagram.
Diagram Connects one part of an activity diagram to another part on the same diagram. They
Connector represent another way to show looping behavior.
Fork Node Separates a single incoming activity flow into multiple outgoing activity flows.
Initial Flow Points to the state that the object, use case, or operation enters when the activity
starts.
Join Node Merges multiple incoming activity flows into a single outgoing activity flow.
Merge Node Joins multiple activity flows into a single, outgoing activity flow.
Object Node Represents an object passed from the output of the action for one state to the input
of the action for another state.
Send Action Represents sending actions to external entities. The Send Action is a language-
independent element, which is translated into the relevant implementation language
during code generation.
Subactivity Represents a nested activity diagram. Subactivities represent the execution of a
non-atomic sequence of steps of some duration nested within another activity.
Swimlane Organizes activity diagrams into sections of responsibility for actions and
Frame subactions.
Swinlane Divides the swimlane frame using vertical, solid lines to separate each swimlane
Divider (actions and subactions) from adjacent swimlanes.
Drawing an action
To draw an action for your activity diagram:
2. Click or click-and-drag in the activity diagram to place the action at the intended location.
An action appears on an activity diagram as a rectangle with curved edges.
4. Press Ctrl+Enter or click the Select arrow in the toolbar to terminate editing.
By default, the action expression, which does not need to be unique within the diagram, is
displayed inside the action symbol. For information on modifying the display, see Displaying an
action.
Name specifies the name of the action. The description of the action can be entered into
the text area on the Description tab. This description can include a hyperlink. For more
information, see Hyperlinks.
L specifies the label for the element, if any. For information on creating labels, see
Descriptive labels for elements.
Stereotype specifies the stereotype of the element, if any. They are enclosed in guillemets,
for example «s1» and enable you to tag classes for documentation purposes. For
information on creating stereotypes, see Stereotypes.
– To select from a list of current stereotypes in the project, click the folder with
binoculars button.
– To sort the order of the stereotypes, click the up and down arrows button.
Note: The COM stereotypes are constructive; that is, they affect code generation.
Action specifies an action in an activity diagram. This is the text you typed into the
diagram when you created the action.
Displaying an action
You can show the name, action, or description of the action in the activity diagram.
1. Right-click the action and select Display Options to open the Display Options window.
2. Select the appropriate values.
Activity frames
You might want to create an activity frame in the activity diagram to hold a group of elements and
then assign it activity parameters. The parameters indicate inputs and outputs of data to the frame.
The frame can also be synchronized with a call behavior.
2. Right-click the class and select Add New > Diagrams > Activity.
3. Right-click in the diagram drawing area and select the Show/Hide Activity Frame
option. The activity frame displays in the diagram.
You may use the Features window to define the frame.
2. Right-click the project or a package in the browser and select Features to open the
Features window.
4. Click OK.
5. Right-click a class and select Add New > Diagrams > Activity. The new diagram
contains an activity frame.
2. Select the General tab and check Analysis Only and click OK.
3. Add some activity parameters to the activity frame and set the name, type, and direction of
the pins.
4. Create another activity diagram and check Analysis Only in the General tab.
5. Drag and drop the first activity frame into the second activity diagram.
This action creates call behavior, that is referencing to the first activity, and small pins with the
same name, type and direction as in the referenced activity.
Action blocks
Action blocks represent compound actions that can be decomposed into actions. Action blocks can
show more detail than is possible in a single, top-level action. You can also use pseudocode, text,
or mathematical formulas as alternative notations. Activity flows inside an action block cannot
cross the action block boundary.
2. Click or click-and-drag in the activity diagram to place the action block at the intended
location. An action block appears on an activity diagram as a rectangle.
3. Draw actions and activity flows inside the action block to express the activity being
modeled.
The Record_and_Send_Messages activity shown in the following sample action block shows
several activities.
Name specifies the name of the action block. The description of the action block can be
entered into the text area on the Description tab. This description can include a hyperlink.
For more information, see Hyperlinks.
L specifies the label for the element, if any. For information on creating labels, see
Descriptive labels for elements.
Stereotype specifies the stereotype of the action block, if any. They are enclosed in
guillemets, for example «s1» and enable you to tag classes for documentation purposes.
For information on creating stereotypes, see Stereotypes.
– To select from a list of current stereotypes in the project, click the folder with
binoculars button.
– To sort the order of the stereotypes, click the up and down arrows button.
Note: The COM stereotypes are constructive; that is, they affect code generation.
To create a subactivity from an action block, right-click the action block and select Create Sub
Activity Diagram. Rational Rhapsody creates a new subchart containing the former contents of
the action block.
Consider the action block shown in the following figure. When you create a subactivity for the
action block, the parent state changes to that shown in the following figure.
The icon in the lower right corner indicates that the action block has a subchart.
Subactivities
Subactivities represent nested activity diagrams. Subactivities represent the execution of a non-
atomic sequence of steps of some duration nested within another activity. Internally, a subactivity
consists of a set of actions, and possibly a wait for events. In other words, a subactivity is a
hierarchical action during which an associated subactivity diagram is executed. Therefore, a
subactivity is a submachine state that executes an activity diagram.
The nested activity diagram must have an initial (default) state and a final activity (see Local
termination semantics). When an input activity flow to the subactivity is triggered, execution
begins with the initial state of the nested activity diagram. The outgoing activity flows from a
subactivity are enabled when the final activity of the nested activity diagram is reached (when the
activity completes) or when triggering events occur on the transitions. Because states in activity
diagrams normally do not have triggering events, subactivities are normally exited when their
nested graph is finished.
Creating a subactivity
To draw a subactivity:
2. Click (or click-and-drag) in the activity diagram to place the subactivity at the intended
location.
A subactivity looks like an action.
Note
The behavior of “activity final” is controlled by the
CG::Statechart::LocalTerminationSemantics property.
2. Click in the activity diagram to place the final activity at the intended location.
3. Draw a activity flow from any kind of state to the final activity.
4. If wanted, enter a guard condition to signal the end of the activity. A final activity appears
as a circle with a black dot in the middle:
As with the other connectors, final activities and their activity flows are included in the browser
view.
Object nodes
Actions operate on objects and are used by objects. These objects either initiate an action or are
used by an action. Normally, actions specify calls sent between the object owning the activity
diagram (which initiates actions) and the objects that are the targets of the actions. An object node
represents an object passed from the output of the action for one state to the input of the action for
another state.
Note
An object node can only be a leaf element; its meaning cannot contain other elements.
As with other states, only one object node can have the same name in the same parent state.
2. Click or click-and-drag in the activity diagram to place the node at the intended location.
Name specifies the name of the object node. The default name is state_n, where n is an
incremental integer starting with 0. The description of the action block can be entered into
the text area on the Description tab.
L specifies the label for the element, if any. For information on creating labels, see
Descriptive labels for elements.
Stereotype specifies the stereotype of the object node, if any. They are enclosed in
guillemets, for example «s1» and enable you to tag classes for documentation purposes.
For information on creating stereotypes, see Stereotypes.
– To select from a list of current stereotypes in the project, click the folder with
binoculars button.
– To sort the order of the stereotypes, click the up and down arrows button.
Note: The COM stereotypes are constructive; that is, they affect code generation.
In State specifies the required states of the object node.
Represents lets you select a class/type to associate with the node from a list of project
classes/types or enter the name of a new class. For more information, see Associate an
object node with a class.
Right-click the object node in the diagram to display the Features window and select the
class/type from the list in the Represents field.
Dragging a class/type from the browser into the activity diagram automatically associates
the class/type with the object node.
In the activity diagram, the associated node displays the name of its associated class/type in the
name compartment.
Click the Call Behavior button on Diagram Tools and drawing the behavior operation
in the diagram.
Click or click-and-drag an operation from the browser in the activity diagram and place
the behavior at the intended location.
Note
If the behavior operation dropped in the activity diagram has no association with the
classifier, an empty call is created.
Activity flows
Activity diagrams can have activity flows, default flows, and loop activity flows on action blocks
and join activity flows. These activity flows in activity diagrams are the same as the corresponding
activity flows in statecharts, with the following exceptions:
Outgoing activity flows from states can have triggers, but those from actions, action
blocks, or subactivities cannot.
Outgoing activity flows from actions, action blocks, and subactivities can have only
guards and actions.
Activity flows exiting or entering fork or join bars have the following constraints:
3. Drag the cursor to the edge of the default state of the activity and release the mouse button.
For more information on default flows, see Statecharts.
For an example of an action block with a loop activity flow, see Creating a final activity. For more
information on loop (self) transitions, see Statecharts.
3. In the edit box, type the new label (or modify the existing one).
4. Press Ctrl+Enter or click outside the label to terminate editing.
Connectors
Activity diagrams can have the following connectors:
Merge nodes
Condition
Diagram
The following sections describe these connectors in detail.
2. Click in the activity diagram to place the junction at the intended location.
3. Draw activity flows going into, and one activity flow going out of the junction.
2. Click, or click-and-drag, in the activity diagram to position the decision node at the
intended location. A decision node appears on an activity diagram as a diamond.
3. Draw at least two states that will become targets of the outgoing activity flows.
4. Draw an incoming activity flow from the source state to the decision node.
5. Draw and label the outgoing activity flows from the decision node to the target states.
This activity diagram shows the following behavior: When the phone rings, if someone picks up
on the other end, you can talk; otherwise, you must leave a message. The decision node represents
the decision point. In other words, after the PhoneRings() operation, if SomeonePicksUp
resolves to True, the Talk() operation is called. Otherwise, the LeaveMessage() operation is
called.
Use the Display Options window to determine whether to display the name, label, or nothing for
the decision node.
2. Click to place the source diagram connector at the intended location and label the
connector.
3. Repeat to place the target diagram connector at the intended location in the diagram, and
give it the same name as the source connector.
Rational Rhapsody defines activity diagrams as meaningful only if join and fork bars are well-
structured in the same sense as well-structured parentheses. In other words, they must use proper
nesting. The only exception to this rule is that a join or fork connector with multiple ingoing/
outgoing activity flows can be used in place of a number of join or fork connectors with only two
ingoing or outgoing activity flows each.
Rational Rhapsody tolerates less-than-meaningful activity charts, provided that they can be
extended into meaningful ones by adding activity flows (for example, a fork with activity flows
that never merge back).
As you draw activity diagrams, Rational Rhapsody prevents you from drawing constructs that
violate the meaningfulness of the activity diagram by displaying a “no entry” symbol.
3. Click or click-and-drag in the activity diagram to place the join node bar in the intended
location.
By default, the join bar is drawn horizontally. To flip it, see Rotating join or fork bars.
4. Draw incoming activity flows from each of the source states to the join node bar.
5. Draw a state that will be the target of the outgoing activity flow.
6. Draw an outgoing activity flow from the join node bar to the target state.
A join node is shown as a bar with two or more incoming activity flow arrows and one outgoing
activity flow arrow.
2. Click, or click-and-drag, in the activity diagram to place the fork node bar at the intended
location. Fork node bars can be vertical or horizontal only.
By default, the join line is drawn horizontally. To flip it, see Rotating join or fork bars.
3. Draw a source state and an incoming activity flow coming into the fork node bar.
4. Draw the target states and the outgoing activity flows from the fork node bar.
A fork node is shown as a heavy bar with one incoming activity flow and two or more outgoing
activity flow arrows.
To rotate a join or fork bar, right-click the join or fork bar and select either Flip Right or Flip Left.
2. Click-and-drag one of the highlighted selection handles until the join or fork bar is the
wanted length.
1. Click in the middle of the join or fork bar, away from the selection handles, and drag the
bar to the intended location.
2. Release the mouse button to place the join or fork bar at the new location.
Name specifies the name of the element. The default name is <element>_n, where n is
an incremental integer starting with 0. Add any additional information using the
Description tab.
L specifies the label for the element, if any. For information on creating labels, see
Descriptive labels for elements.
Stereotype specifies the stereotype of the element, if any. They are enclosed in guillemets,
for example «s1» and enable you to tag classes for documentation purposes. For
information on creating stereotypes, see Stereotypes.
– To select from a list of current stereotypes in the project, click the folder with
binoculars button.
– To sort the order of the stereotypes, click the up and down arrows button.
Note: The COM stereotypes are constructive; that is, they affect code generation.
Swimlanes
Swimlanes divide activity diagrams into sections. Each swimlane is separated from adjacent
swimlanes by vertical, solid lines on both sides. These are the features of swimlanes:
Creating swimlanes
To use swimlanes in an activity diagram, you first need to create a swimlane frame. If you do not,
Rational Rhapsody generates an error message.
Note
There can be only one swimlane frame in an activity diagram. Once you have created a
frame, the Swimlane Frame tool is unavailable.
To draw a swimlane:
2. The cursor turns into crosshairs. In the drawing area, click one corner to draw the
swimlane frame (a box).
4. The cursor turns into a vertical bar. When it is at the intended location, left-click to place
the divider. Rational Rhapsody creates two swimlanes, named swimlane_n and
swimlane_n+1, where n is an incremental integer starting at 0.
If you draw another divider, it divides the existing swimlane into two swimlanes, with the
new swimlane positioned to the left of the divider.
Swimlanes have a minimum width. If you enlarge a swimlane, the extra space is added to
the right of the swimlane. To resize a swimlane, move the divider to the left or the right.
If a swimlane contains activity diagram elements, you cannot reduce the size of that
swimlane so its divider is positioned to the left of any of those elements, because that
would force the elements into a different swimlane.
A swimlane maps into a partition of states in the activity diagram. A state symbol in a
swimlane cases the corresponding state to belong to the corresponding partition.
Name specifies the name of the element. The default name is swimlane_n, where n is an
incremental integer starting with 0. Add any additional information using the Description
tab.
L specifies the label for the element, if any. For information on creating labels, see
Descriptive labels for elements.
Stereotype specifies the stereotype of the swimlane, if any. They are enclosed in
guillemets, for example «s1» and enable you to tag classes for documentation purposes.
For information on creating stereotypes, see Stereotypes.
– To select from a list of current stereotypes in the project, click the folder with
binoculars button.
– To sort the order of the stereotypes, click the up and down arrows button.
Note: The COM stereotypes are constructive; that is, they affect code generation.
Represents specifies the class to which the swimlane applies.
Note
Swimlane nodes cannot be deleted.
Note that after the deletion, the frame and swimlanes are removed, but the elements they contained
still exist in the activity diagram.
Swimlane limitations
Note the following design and behavior limitations apply to swimlanes:
You should not draw actions on swimlane divider lines. In other words, do not draw
actions that overlap into another swimlane.
Swimlanes in subactivity diagrams are not supported.
You cannot use the browser to create or drag-and-drop swimlanes.
To add a call, either click the Call Behavior button on Diagram Tools, or drag-and-drop the
activity (or activity diagram) from the browser into the activity diagram. Rational Rhapsody
creates the call in the activity diagram and in the browser.
The called behavior has the same name as the called object. The called behavior, PushButton, is
marked with an at-symbol icon, as shown in the following figure.
This is displayed in the project browser under the activity diagram containing the behavior.
1. Highlight the called behavior in either the browser or diagram. Right-click and select
Features.
2. Click the right arrow button beside the Reference field in the General tab.
3. Use the ActivityGraph Tree window to navigate to the activity diagram that the called
behavior represents.
Action pins and activity parameters are diagram elements and appear in the browser. However,
there is no code generated for these elements.
1. Highlight an element in the browser that needs an activity diagram for analysis purposes
only.
2. Right-click the element and select Add New > Diagrams > Activity Diagram.
3. Right-click the Activity Diagram now listed in the browser and select Features to open
the Features window.
6. The system then places the Action Pin and Activity Parameter buttons on Diagram
Tools.
1. Click the small Action Pin button at the bottom of the available Diagram Tools.
The pin displays on the border of the action closest to the point that was clicked. The name
displays alongside the pin. The default name is pin_n.
1. Click the Activity Parameter button at the bottom of the Diagram Tools.
2. Click the action block to which the activity parameter should be added.
The activity parameter displays on the border of the action block closest to the point that was
clicked. The name displays inside the activity parameter node. The default name is parameter_n.
Pins/parameters always remain attached to their action/action block. However, they can be
moved around the perimeter of the action/action block.
Action pins are a fixed size. Activity parameters, however, can be resized.
Pins/parameters cannot be copied and pasted.
All pin/parameter operations can be undone.
In the browser, pins/parameters appear beneath the action/action block to which they
belong.
When an action pin / activity parameter is deleted from a diagram, it is removed from both
the view and the model.
Statechart mode
The following sections describe how local termination is implemented in statechart mode for
various kinds of states.
Or states
The following local termination rules apply to Or states:
An Or state that has a final activity is completed when the final activity is reached.
An Or state without a final activity is completed after finishing its entry action.
An outgoing activity flow from an Or state can have a trigger (as with statecharts).
An outgoing null transition (activity flow without a trigger) from an Or state can be taken
only if the Or state is completed.
If an Or state with a final activity has a history connector, the last state of the history
connector is always the final activity, after it has been reached once.
An Or state can be exited by any activity flow, including a null transition, from one of its
substates (as with statecharts).
Leaf states
A leaf state is completed after finishing its entry action.
Component states
The following local termination rules apply to component states:
Because a component state is a kind of Or state, all the local termination rules for Or states
also apply to component states.
A join transition (from several component states) is activated only if all the sources
(component states) are completed.
And states
An outgoing null transition from an And state is activated only if all of its components are
completed.
IS_COMPLETED() macro
You can use the IS_COMPLETED() macro in a statechart to test whether a state is completed.
Completion means that any of the conditions for local termination described in the previous
sections are true. The macro works the same for both flat and reusable implementations of
statecharts.
An Or state that has a final activity is completed when the final activity is reached.
An Or state without a final activity is never completed.
Code generation
In previous releases, Rational Rhapsody supported code generation only from activity diagrams
associated with classes, not from activity diagrams associated with operations or use cases.
Rational Rhapsody Developer for C++ generates functor-based code for activity diagrams
associated with operations. Functor-based code reuses the code generation functionality for
activity diagrams of classes. Code is generated into a new class (called the functor class), which
implements an activity diagram on the class level. The task of executing the modeled operation (an
operation associated with an activity diagram) is delegated to the new class. The class that
delegates the task is known as the owner class.
You specify whether to generate code for an activity diagram by setting the property
CPP_CG::Operation::ImplementActivityDiagram to Checked. This property is set to Cleared
by default.
Functor classes
Consider the following class:
The following figure shows the activity diagram associated with the increaseSpeed modeled
operation.
In the example model, Motor is the owner class, and FunctorIncreaseSpeed_int executes
the modeled operation increaseSpeed.
This activity diagram increments the value of the class attribute speed by the value specified by
the amount argument, then returns the incremental value. Note the following information:
An activity diagram should never contain code with the return keyword because the
current implementation executes the code fragments of the diagram (that appear in
actions, activity flows, and so on) in contexts of different operations. Returning from
those contexts (operations) does not have the same effect as returning from the body of a
regular operation.
Instead, you should set the return value to the rpyRetVal variable (shown in the
previous figure), which is always generated for operations that return values.
There are two ways an operation can finish and return control to its caller:
– Once the diagram reaches a “stable” state (there are no more activity flows to
take), the operation is considered to have finished its job and it returns control
to its caller.
– The diagram reaches a termination connector at the top level.
The actual execution of the code does not occur within the scope of the object that owns
the operation. Instead, the code is executed in another object whose sole purpose is to
execute the diagram. During the execution of the code in the diagram, the this pointer
references a special-purpose object (the functor object) that contains the code in the
diagram (in states, on activity flows, and so on). To refer to the owner object, you can use
the this_ variable, which always exists for this purpose.
To make coding more natural, direct access to the attributes of the class that owns the
operation (without the need for this_) is made possible by supplying references in the
functor object. The functor class contains references that correspond to each owner class
attribute and have the same name. The constructor of the functor class contains arguments
to initialize each attribute; initialization is done when the owner class creates an object of
the functor class.
You can control the code generation of the attribute references by setting the value of the
CPP_CG::Operation::ActivityReferenceToAttributes property to Checked (the
default value).
Activity diagrams do not require “And” states to represent concurrent behavior. Activity
diagrams cannot include “And” states.
Forks can end in states that are not within two orthogonal states.
Activity diagrams for operations cannot receive events, nor can they have state nodes.
You cannot animate the activity diagrams associated with operations. However, an
animated sequence diagram for the model records the fact that a modeled operation was
called. In addition, the call and object stacks record the owner object (not the functor
object) as the object that receives the message.
This feature supports only a subclass of diagrams that do not contain events (including
timeout events) or triggered operations.
If a class attribute and an argument of the modeled operation have the same name, there
will be a name collision that results in a compiler error. To avoid this problem before
attempting to generate code, omit the class attribute that causes the collision. This should
not affect the semantics of the operation, because operation arguments hide class
attributes.
The name of the functor class will contain the signature of the modeled operation, thereby
supporting overloaded operations. Complicated type names will be converted to strings
appropriate for building C++ identifiers. For example, “::” characters are replaced with
underscores.
Because the code in the diagram does not execute within the scope of the modeled
operation, there is no direct access to the this variable. Instead, access this variable
using the this_ attribute of the functor class. This is also the preferred way to start
methods in the owner class.
Operations with variable-length argument lists are not supported.
Global operations with activity diagrams are not supported.
You can model methods and functions using flow charts in all Rational Rhapsody programming
languages. Only in Rational Rhapsody in C and Rational Rhapsody in C++ can readable structured
code be generated from a flow chart. During code generation, for the actions defined in a flow
chart Rational Rhapsody can generate structured code for If/Then/Else, Do/While, and While/
Loops.
The code generator algorithm for a flow chart can identify Loops and Ifs, the expressions for these
constructs is on the guards of the action flows.
This flow chart approach to code generation is to reduce the diagram to blocks of sequential code
and then search for If/Loop patterns in those blocks. The following structured programming
control structures are supported in flow charts:
Simple If
If/Then/Else
While loops (where the test is at the start of the loop)
Do/While loops (where the test is at the end of the loop)
If the algorithm does not succeed to impose the above structure, then it will need to use a GoTo.
Decision points that show branching points in the program flow based on guard
conditions.
Actions that represent function invocations with a single exit action flow taken when the
function completes. It is not necessary for all actions to be within the same object.
Action blocks that represent compound actions that can be decomposed into actions.
However, flow charts do not include And states, and flow charts for operations cannot receive
events.
Start Action
(Initial Flow)
Action
Guard Guard
Drawing
Button Name Description
Buttons
Action Represents the member function call within a given operation. For more
information, see Actions.
Action Block Represents compound actions that can be decomposed into actions. For more
information, see Action blocks.
Activity Flow Defines the flow and its guards to supply the test for Ifs or Loops. Activity flows
without guards define the default sequential flow of the flow chart. For more
information, see Activity flows.
Initial Flow Shows the flow origination point from an element. For flow charts, this default
flow is the initial flow, and for code purposes, indicates the start of code. For
more information, see Drawing initial flows.
Loop Activity Represents behavior repeating in a program. For more information, see
Flow Drawing loop activity flows.
DecisionNode Shows branching conditions. For more information, see Drawing decision
nodes.
ActivityFinal Provides local termination semantics. The flow chart returns at this point to the
operation/function that started it. For more information, see Activity final.
MergeNode Combines different flows to a common target. For more information, see
Drawing merge nodes.
Send Action Represents the sending of events to external entities. For more information, see
Send action elements.
Actions
Flow charts decompose a system into actions that correspond to activities. These diagrammatic
elements, called actions, are member function calls within a given operation. In contrast to normal
states (as in statecharts), actions in flow charts terminate on completion of the activity, rather than
as a reaction to an externally generated event.
Each action can have an entry action, and must have at least one outgoing action flow. The implicit
event trigger on the outgoing action flow is the completion of the entry action. If the action has
several outgoing action flows, each must have its own guard condition.
During code generation, code is derived from the actions on a flow chart.
1. In the browser, right-click the model element for which you want to create a flow chart,
such as a function.
Drawing an action
To draw an action:
1. Create a flow chart and click the Action button on Diagram Tools.
2. Click or click-and-drag in the flow chart to place the action where you want it.
An action appears on a flow chart as a rectangle with curved edges.
3. Type a name for the action, then press Ctrl+Enter or click the Select arrow in the toolbar
to terminate typing mode.
By default, the action expression, which does not need to be unique within the flow chart, is
displayed inside the action symbol. For information on modifying the display, see Displaying an
action.
Name specifies the name of the action. The description of the action can be entered into
the text area on the Description tab. This description can include a hyperlink. For more
information, see Hyperlinks.
L specifies the label for the element, if any. For information on creating labels, see
Descriptive labels for elements.
Stereotype specifies the stereotype of the element, if any. They are enclosed in guillemets,
for example «s1» and enable you to tag classes for documentation purposes. For
information on creating stereotypes, see Stereotypes. By default, flow charts have a new
term stereotype of “flowchart.”
Note: The COM stereotypes are constructive; that is, they affect code generation.
Action specifies an action in a flow chart. This is the text you typed into the flow chart
when you created the action.
The Overridden check box allows you to toggle the check box on and off to view the
inherited information in each of the window fields and decide whether to apply the
information or revert back to the currently overridden information.
For more information about the Features window, see The Features window.
Displaying an action
You can show the name, action, or description of the action in the flow chart.
1. Right-click the action and select Display Options to open the Display Options window.
2. Select the appropriate values and click OK.
Action blocks
Action blocks represent compound actions that can be decomposed into actions. Action blocks can
show more detail than might be possible in a single, top-level action. You can also use pseudocode,
text, or mathematical formulas as alternative notations.
Note that for action blocks, there must be a default flow at the start and a final activity at the end,
and activity flows cannot cross the blocks boundaries to actions in the block (though they might
enter and leave the block itself). The code generator will put blocks code in curly braces and this
has language significance regarding variable scope and lifetime.
2. Click or click-and-drag in the flow chart to place the action block where you want it.
Action blocks appear as rectangles on a flow chart.
3. Draw actions and activity flows inside the action block to express the activity being
modeled.
Name specifies the name of the action block. The description of the action block can be
entered into the text area on the Description tab. This description can include a hyperlink.
For more information, see Hyperlinks.
L specifies the label for the element, if any. For information on creating labels, see
Descriptive labels for elements.
Stereotype specifies the stereotype of the action block, if any. They are enclosed in
guillemets, for example «s1» and enable you to tag classes for documentation purposes.
For information on creating stereotypes, see Stereotypes. By default, flow charts have a
new term stereotype of “flowchart.”
Note: The COM stereotypes are constructive; that is, they affect code generation.
Activity final
An activity final provides local termination semantics. The flow chart returns at this point to
the operation/function that started it.
Note
The behavior of the “activity final” is controlled by the
CG::Statechart::LocalTerminationSemantics property. See the definition provided for
the property on the applicable Properties tab of the Features window.
2. Click in the flow chart to place the final activity where you want it.
A final activity looks like a circle with a black dot in its center.
4. If you want, enter a guard condition to signal the end of the activity.
As with the other connectors, final activities and their flows are included in the Rational Rhapsody
browser.
Activity flows
Flow charts can have activity flows (such as activity flows, default flows, and loop activity flows)
on actions and action blocks. Activity flows define flow and their guards supply the test for Ifs or
Loops. Activity flows without guards define the default sequential flow of the flow chart.
When an “If” flow is detected, then the activity flow with a guard defined on it is the body
of the “if.”
For all multiple exit activity flows there should always be one without a guard to define
the sequential flow.
Activity flows in flow charts are the same as the corresponding transitions in activity diagrams,
with the following exceptions:
3. Drag the cursor to the edge of the target action and release to anchor the activity flow.
3. Drag the cursor to the edge of the default action of the activity and release the mouse
button.
For an example of an action block with a loop activity flow, see Activity final.
Connectors
Flow charts can have the following connectors:
MergeNode
DecisionNode
2. Click in the flow chart to place the junction where you want it.
3. Draw flows going into, and one flow going out of the junction.
3. Draw at least two actions that will become targets of the outgoing action flows.
4. Draw an incoming action flow from the source action to the decision node.
5. Draw and label the outgoing action flows from the decision node to the target actions.
This flow chart shows the following behavior: When the phone rings, if someone picks up on the
other end, you can talk; otherwise, you must leave a message. The decision node represents the
decision point. In other words, after the PhoneRings() operation, if SomeonePicksUp resolves
to True, the Talk() operation is called. Otherwise, the LeaveMessage() operation is called.
Use the Display Options window for the decision node to determine whether to display its name,
label, or nothing.
Code generation
You specify whether to generate code for a flow chart by setting the
C_CG::Operation::ImplementFlowchart property to Checked (which is the default).
– If the code is not structured, then the flow charts will generate GoTo code. To
avoid GoTo code, use the sample patterns for structured blocks as shown in
the flow charts that are illustrated and documented in the Flowchart model
provided with Rational Rhapsody in C, which is located in the path noted
above.
Sequence diagrams (SDs) describe message exchanges within your project. You can place
messages in a sequence diagram as part of developing the software system. You can also run an
animated sequence diagram to watch messages as they occur in an executing program.
Sequence diagram show scenarios of messages exchanges between roles played by objects. This
functionality can be used in numerous ways, including analysis and design scenarios, execution
traces, expected behavior in test cases, and so on.
Sequence diagrams help you understand the interactions and relationships between objects by
displaying the messages that they send to each other over time. In addition, they are the key tool
for viewing animated execution. When you run an animated program, its system dynamics are
shown as interactions between objects and the relative timing of events.
Note
Rational Rhapsody message diagrams are based on sequence diagrams. Message diagrams,
available in the FunctionalC profile, show how the files functionality might interact through
messaging (through synchronous function calls or asynchronous communication). Message
diagrams can be used at different levels of abstraction. At higher levels of abstractions,
message diagrams show the interactions between actors, use cases, and objects. At lower
levels of abstraction and for implementation, message diagrams show the communication
between classes and objects.
Message diagrams have an executable aspect and are a key animation tool. When you
animate a model, Rational Rhapsody dynamically builds message diagrams that record the
object-to-object messaging.
Names pane, which is the top portion of the diagram. The Names pane is a control to
identify instance lines when the role names are not visible.
Message pane shows the messages passed between instance lines in the diagram.
Names pane
The names pane contains the name of each instance line or classifier role. In a sequence diagram, a
classifier role represents an instance of a classifier. It describes a specific role played by the
classifier instance to perform a particular task. A classifier role is shown as an instance line with a
text header (name) with a box drawn around it. A classifier role can realize a classifier (class or
actor) of the static model object.
Changing names
Names that are too long to fit in the pane continue past the divider, running down behind the lower
pane. To change the size of the names pane, click the dividing line and drag it up or down.
You can change the font and edit the names in the names pane using the menu for text items.
If you change the name to a class that does not yet exist in the model, Rational Rhapsody asks if
you want to create that class. For example, if you type x:X, Rational Rhapsody asks if you want to
create the class X.
Message pane
The message pane contains the elements that make up the interaction. In the object pane, system
borders and instances are displayed as instance line, which are vertical lines with a box containing
the role name at the top. Messages, such as events, operations, and timeouts are generally shown as
horizontal and slanted arrows.
The messages appear in sequence as time advances down the diagram. The vertical distance
between points in time indicates only the sequence in time and not any time scale.
ClassCentricMode specifies whether classes are realized when you draw instance lines.
The possible values are as follows:
– Checked means instance names of the form <xxx> are treated as class names,
not instance names. For example, if you create a new instance line named c,
Rational Rhapsody creates a class named c and displays it in the sequence
diagram as :c.
– Cleared means when you create an instance line, it is named role_n by
default, which represents an anonymous instance. This is the default value.
RealizeMessages specifies whether messages are realized when you create them. The
possible values are as follows:
– Checked where in Design mode, when you type in a message name, Rational
Rhapsody asks if you want to realize the message. If you answer no, the
message is unspecified. For example, you could use an unrealized message to
describe a message that is part of the framework (such as takeEvent()),
without actually adding it to the model. (In analysis mode, the confirmation is
controlled by the property
SequenceDiagram::General::ConfirmCreation.)
– Cleared where you can draw message lines freely, without messages from
Rational Rhapsody about realization. This is the default value.
CleanupRealized specifies whether to delete messages in the sequence diagram if the
corresponding operation is deleted. The possible values are as follows:
– Checked means to delete the messages when the operation is deleted.
– Cleared means to not delete the messages when the operation is deleted. This
is the default value.
For sequence diagrams produced in Rational Rhapsody 4.0 or earlier, all three of these properties
are Cleared.
When you realize a message, Rational Rhapsody creates a new message in just the manner as if
you selected <New> in the Realization field in the Features window. If you realize a classifier role,
Rational Rhapsody creates a class with the same name as designated in the role name, with a
leading colon. For example, Dishwasher becomes :Dishwasher.
Drawing
Name Description
Tool
Instance line Shows how an actors participates in the scenario. For more information, see
Creating an instance line.
System border Represents the environment. Events or operations that do not come from instance
lines shown in the chart are drawn coming from the system border. For more
information, see Creating a system border.
Message Represents an interaction between parts, or between a part and the environment. A
message can be an event, a triggered operation, or a primitive operation. For more
information, see Creating a message.
Reply message Represents the response from a message sent to a part or the environment. For
more information, see Creating a reply message.
Create arrow Marks when an instance is created. It can originate from the system border or
another instance. It is a horizontal, dotted line from the creator object to the new
object. An object can have only one “create arrow.” You can label the create arrow
with construction parameters.
Destroy arrow Marks the destruction of an object. It is a dotted line from the destroying object to the
object being destroyed. It can be either a horizontal line or a message-to-self. For
more information, see Creating a destroy arrow.
Timeout Indicates when an event stops and might include a parameter indicating the length of
the time the event is stopped. This is a type of message that is always
communicating with itself. For more information, see Creating a timeout.
Cancelled indicates the condition when an event that has timed out should restart. For more
timeout information, see Creating a cancelled timeout.
Time interval Can be used to create a waiting state with an event stopping for this predefined
interval and then automatically restarting. For more information, see Specifying a
time interval.
DataFlow Indicates the flow of data between two objects. You can use the Features window to
select the flowport to which it is connected on the receiving object and change the
value being sent. This connection is also automatically added to the sequence
diagram during animation. For more information, see Creating a dataflow.
Partition line Separates phases of a scenario represented in the sequence diagram. For more
information, see Creating a partition line.
Drawing
Name Description
Tool
Condition mark Indicates that the object is in a certain condition or state at this point in the sequence.
For more information, see Creating a condition mark.
Execution Shows the beginning and end of the unit of behavior (the actions performed by an
Occurrence operation or event) that is triggered by a specific message. For more information,
see Creating execution occurrences.
Interaction Refers to another sequence from within a sequence diagram. This allows complex
Occurrence scenarios to be divided into smaller, reusable scenarios. For more information, see
Creating an interaction occurrence.
Interaction Groups related elements and define specific conditions under which each group of
Operator elements occurs. For more information, see Creating interaction operators.
Interaction Create two subgroups of elements within the sequence diagram. This might be used
Operand to create two paths that are supposed to be carried out in parallel or to define two
Separator possible paths and a condition that determines which is to be followed. For more
information, see Adding an interaction operand separator to an interaction
operator.
Lost Message Indicates a message sent from an instance that never arrives to its destination. This
item is not supported in code generation or animation.
Found Indicates a message that arrives at an instance, but its target is unknown. This item
Message is not supported in code generation or animation.
Destruction Indicates the destruction of the instance, such as the destroy arrow, has happened.
Event This item is not supported in code generation or animation.
2. Move the cursor into the drawing area, then click to place the system border. At this point,
the system border is anchored in place.
3. Because the system border represents the environment, it is named ENV by default. If
wanted, rename the system border.
In addition to creating, deleting, and modifying the name of an instance line, you can realize the
instance line to a class or actor in the static model.
3. Move the line to a suitable location, then click to dock the line into place.
5. If you specified design mode, Rational Rhapsody names the instance line :class_n by
default. If the specified class does not exist, Rational Rhapsody asks if you want to create
it. Click OK.
6. You can continue creating instance lines, or return to select mode by clicking the Select
tool.
If you prefer, you can place several lines and rename them later. Rational Rhapsody gives them
default names until you rename them. For information on renaming instance lines, see Message
line menu. Note that the sequence diagram automatically expands the diagram as necessary as you
add more instance lines.
Note
To shift one or more messages to different instance lines, select the relevant messages and
press Ctrl+Right arrow, or Ctrl+Left arrow. The messages “jump” to the new source and
destination instance lines. This replaces the cut and paste (or drag) functionality of
messages between instance lines in the same diagram.
Instance lines reference classes in the model. If you rename an instance line to another class name
that exists in the model, the line acts as a view to the other class in the model. If the class does not
exist, Rational Rhapsody will create it.
Note
The names for instance lines are resizable text frames. Text wraps to match the contour of
the bounding box.
If you specified analysis mode, Rational Rhapsody names the instance line role_n by default and
does not prompt you for class information. The following figure shows a new instance line in an
analysis SD.
If you specified design mode, Rational Rhapsody names the instance line :class_n by default. If
the specified class does not exist, Rational Rhapsody asks if you want to create it. The following
figure shows a new instance line in a design SD.
Note that Classifier role names are animated when their expression can be mapped to an existing
object.
Examples:
We have a class A and an object a:A who is the only object of A. All the following names will be
mapped to it:
:A
a:A
A[0]:A
A[#0]:A
Suppose that instead of a:A, we have a single instance of A as a part itsA of another object b:B.
:A
b->itsA:A
B[0]->itsA:A
A[#0]:A
B[#0]->itsA->a:A
The same instance mappings apply as described in Instance Names.
Creating a message
A message represents an interaction between objects, or between an object and the environment. A
message can be an event, a triggered operation, or a primitive operation. In the metamodel, a
message defines a specific kind of communication. The communication could be raising a signal,
invoking an operation, or creating or destroying an instance.
The recipient of a message is either a class or a reactive class. Reactive classes have statecharts,
whereas nonreactive classes do not. Reactive classes can receive events, triggered operations, and
primitive operations. Non-reactive classes can receive only messages that are calls to primitive
operations. Events are usually shown with slanted arrows to imply that they are asynchronous
(delivery takes time). Triggered operations are shown with straight arrows to imply that they are
synchronous (happen immediately).
To create a message:
Note: A plus sign displays on each instance line as you move the cursor from one to
the next. This symbol indicates a potential origination point for the wanted
message.
3. Left-click to anchor the start of the message at the intended location, then move the cursor.
A dashed line displays as a guide for the message.
4. Move the cursor lower the start of the message to create a downward-slanted diagonal
line. Click to anchor the end of the message on the target object once the diagonal line has
extended itself to that point.
5. If you specified design mode and the specified message is not realized in the model,
Rational Rhapsody asks if you want to realize it. Click OK.
Rational Rhapsody creates a message with the default name message_n(), where n is an
incremental integer starting with 0. Sequence diagrams automatically expand in length to
accommodate new messages.
To specify the type of operation and its access level, select the Features option from the menu. By
default, Rational Rhapsody creates a primitive operation with public access. For more information,
see The Features window.
Message names
The naming convention for messages is as follows:
message(arguments)
The names for messages can be event or operation names. They can include actual parameters in
parentheses, which would be expressions in the scope of the sender/caller. Message names are
resizable, movable text frames. Text wraps to match the contour of the bounding box.
Note: In Rational Rhapsody versions 4.0 and earlier, if you changed the message
name, Rational Rhapsody asked if you wanted to create a new operation with
the given name.
If you modify the name of an operation that exists in the model, the message is automatically
realized to that operation, and Rational Rhapsody changes its type to the type of that operation
(constructor, event, and so on).
If you change the message name to a message that does not belong to the classifier, it becomes
unspecified (in analysis mode).
Note that any changes you make to property settings apply only to new elements you draw after
making the change, not to existing elements. For example, to have arguments displayed on one
message but not on another message of the same type, set the ShowArguments property before
drawing one message, then reset it before drawing the next message, as shown in this example.
Slanted messages
A message drawn on a slant is interpreted as an event if the target is a reactive class, and as a
primitive operation if the target is a nonreactive class. A slanted message emphasizes that time
passes between the sending and receiving of the message. Slanted messages can cross each other.
Horizontal messages
A message drawn as a horizontal line is interpreted as a triggered operation, if the target is a
reactive class, and a primitive operation if the target is a nonreactive class. The horizontal line
indicates that operations are synchronous.
Message-to-self
A message-to-self is interpreted as an event if the instance is a reactive class. If the instance is a
nonreactive class, a message-to-self is interpreted as a primitive operation.
A message-to-self is shown by an arrow that bends back to the sending instance. The arrow can be
on either side of the instance line. If the message-to-self is a primitive operation, the arrow folds
back immediately. If the message-to-self is an event, the arrow might fold back sometime later.
Name specifies the name of the message. The default name is Message_n, where n is an
incremental integer starting with 0.
L specifies the label for the element, if any. For information on creating labels, see
Descriptive labels for elements.
Stereotype specifies the stereotype of the message, if any. They are enclosed in
guillemets, for example «s1» and enable you to tag classes for documentation purposes.
For information on creating stereotypes, see Stereotypes.
Note: The COM stereotypes are constructive; that is, they affect code generation.
Message Type specifies the type of message (event, primitive operation, and so on).
Note that you cannot change the message type once the message has been realized.
Sequence specifies the order number of a message. Make sure any numbering sequence
you use, such as 1a., 1b., 1.2.1., 1.2.2., and so on ends with a period (.). Rational
Rhapsody needs the ending period to continue the numbering sequence automatically.
Note: In collaboration diagrams, you can modify both the format of the numbering
and the starting point for the numbering. In sequence diagrams, this field is
read-only. You cannot modify the numbering format or the starting point of the
numbering.
Arguments specifies the arguments for the message.
Return Value specifies the return value of the message.
Realization specifies the class that will be realized. This list contains the following
options:
– Existing classes in project.
– <Unspecified> where if this is an analysis SD, this is the realization setting
for the instance line.
– <New> which opens the Class window so you can set up the new class. For
more information, see Class features.
Click the Features button to open the Features window for the class specified in the
list.
In addition, this section lists the sender and receiver objects for the message.
Description describes the message. This field can include a hyperlink. For more
information, see Hyperlinks.
For messages, if the target is an instance of a derived class, the list also includes those message
inherited from its superclass. The target class provides the message, whereas the source class
requires it. You can also think of provided messages as those to which the class responds. At the
implementation level, an event is generated into statechart code that checks for the existence of
that event.
Moving messages
To move a message line:
2. Press Ctrl+Left arrow to move the message to the left, or Ctrl+Right arrow to move it
to the right.
Message types
If you open the Features window for the message, you can select the message type: primitive
operation, or triggered operation, or event. Once defined, these messages are displayed in the
browser, denoted by unique icons. In the browser, you can access modify a message by
right-clicking on it and selecting the appropriate option from the menu.
Note
Once a message has been realized, you cannot change its type.
Events
An event is an instantaneous occurrence that can trigger a state transition in the class that receives
it. Because events are objects, they can carry information about the occurrence, such as the time at
which it happened. The browser icon for an event is a lightning bolt.
Note
If an event argument is of type *& (pointer reference), Rational Rhapsody does not generate
code for it.
Triggered operations
A triggered operation can trigger a state transition in a statechart, just like an event. The body of
the triggered operation is executed as a result of the transition being taken. The browser icon for a
triggered operation is a green operation box overlaid with a lightning bolt.
Note
If an argument of a triggered operation is of type *& (pointer reference), Rational Rhapsody
will not generate code for that argument.
Operations
By default, operations are primitive operations. Primitive operations are those whose bodies you
define yourself instead of letting Rational Rhapsody generate them for you from a statechart.
The browser icon for operations is a three-compartment class box with the bottom compartment
filled in:
Deleting operations
You delete an operation like any other model element in Rational Rhapsody. However, if you
delete an operation that is realized by a message in a sequence diagram, the message becomes
unspecified (in both design and analysis modes).
If you delete an operation, class, or event, the corresponding message lines are not deleted
automatically from the diagram. To have Rational Rhapsody perform this cleanup
automatically, set the SequenceDiagram::General::CleanupRealized property to Checked.
The following figure shows an animated sequence diagram that draws a return value.
You can use any of the following macros depending on your situation:
OM_RETURN. Use this macro in the body of an operation instead of the regular “return”
statement:
Examples:
– Int Test(int& x) {x = 5; OM_RETURN(10);}
– A* Test() {OM_RETURN(newA());}
CALL. Use this macro if you cannot change the operation code or if you want to animate
return values only on specific calls to the operation. Note that this macro can handle only
primitive types.
Example:
Int test(int n) {return n*5;}
void callingFunction()
{
int v;
CALL (v, f00(10));
// after the call v equals 50
}
CALL_INST. Same as CALL, but use CALL_INST when the return value is of a complex type,
such as a class or a union.
Example:
A* test() {return new A();}
void callingFunction()
{
A *a;
CALL_INST(a, test());
// after the call a equals new A[0]
}
CALL_SER. Use this macro when the type has a user-defined serialization function.
Examples:
– char* serializeMe(A*) {...}
– A* test() {return new A();}
void callingFunction()
{
A *a;
CALL_SER(a, test(), serializeME);}
// after the call v equals <string that serializeMe returns>
}
Note that even if you choose not to embed these macros in your application, you can still see
animated return values by explicitly calling an operation through the Operations window. To call
an operation, click the Call operations tool in the Animation toolbar.
Drawing an arrow
An arrow marks when an instance is created. It can originate from the system border or another
instance. It is a horizontal, dotted line from the creator object to the new object. Every object can
have at most one create arrow. You can label the create arrow with construction parameters.
The condition mark remains centered over the instance line. If necessary, other elements on the
sequence diagram are adjusted to accommodate the new size.
Creating a timeout
The notation for timeouts is similar to the notation for events sent by an object to itself. There are
two differences:
For example, on a telephone, a dial tone waits for you to dial. The telephone has a timeout set so if
you do not dial, the dial tone changes to a repeating beep. If you do dial, the timeout is canceled.
A canceled timeout occurs automatically once the state on which the timeout is defined is exited.
As a designer, you do not need to do anything to cancel a timeout. The framework has a call to
cancel a timeout, but you do not need to use it because the code generator inserts it automatically.
When you want to realize a classifier, the list contains all the available classes and actors.
Creating a dataflow
A dataflow in Rational Rhapsody indicates the flow of data between two instances on a sequence
diagram, as shown in the following figure. Rational Rhapsody animation uses this notation to
represent data flow between flow ports. For information on flow ports, see Flow ports.
Note
This feature is not supported in Rational Rhapsody in J.
The dataflow will be realized to the flow port on the receiving instance. The name of the dataflow
is the name of its realized flow port and the data that has been received. For example, for the
dataflow y = 1, flow port y has received the data 1.
Note that the dataflow arrow can be created through the following ways:
You can double-click the dataflow arrow to open its Features window, as shown in the following
figure, from which you can, for example, choose which flow port to connect to and change the
value to send.
Each partition line includes a note positioned at its left end by default. You can move or resize the
note, but a note is always attached to its partition line. If you move the line, the note follows. Notes
contain the default text “note” until you enter text for them.
Alternatively, you can use the Add Interaction Occurrence option in the menu.
2. Place the reference diagram on one or more instance lines to signify that those classes
interact with the referenced sequence diagram. The interaction occurrence displays as a
box with the “ref” label in the top corner, as shown in this example.
By default, when you first create the interaction occurrence (and have not yet
specified which diagram it refers to), Rational Rhapsody names it using the
convention interaction_n, where n is greater than or equal to 0.
4. Use the Realization list to specify the sequence diagram being referenced. When you
select the referenced diagram, the name of the interaction occurrence is updated
automatically to reflect the name of the referenced SD.
5. Click OK.
You can move, rename, and delete reference sequence diagrams just like regular sequence
diagrams. However, if you delete a sequence diagram that references an interaction occurrence, the
interaction occurrence itself is not deleted, but becomes unassociated.
Part decomposition
Instance line decomposition enables you to easily decompose a instance line on a sequence
diagram into a series of parts. For example, if you have a composite class view in one sequence
diagram and want to navigate to its parts, you can click the composite class and open a
collaboration, which shows how its internal parts communicate for a particular scenario.
1. Open the Features window for the instance line. The Classifier Role window opens.
In the sequence diagram, the name of the reference sequence diagram is added to the classifier role
label (after the word “ref”), as shown in this example.
As with other interaction occurrences, navigate to the reference SD by right-clicking the instance
line and selecting Open Reference Sequence Diagram.
Limitations
Note the following limitations for decomposition:
In addition, interaction operators can include a guard to specify specific conditions under which
the path will be taken.
With the interaction operator selected in the diagram, click the type text in the top left
corner and enter the appropriate type.
With the interaction operator selected in the diagram, click the type text and then press
Ctrl+Space and select a type from the list that is displayed.
Open the Features window for the interaction operator, and select a type from the Type
list.
Click [condition] and enter the appropriate expression inside the brackets
Open the Features window for the interaction operator, and type in the expression under
Constraints.
Note
Using Display Options from the context menu, the guards for an interaction operator can be
hidden or shown.
2. Click inside the interaction operator where you would like the division to be.
If necessary, more than one separator can be added to a single interaction operator.
Note
Interaction operators (and interaction operand separators) only appear in the diagram itself.
They do not appear as independent model elements in the browser, nor do they influence
code generation. For this reason, when you display the context menu for an interaction
operator, there is an option to Delete From View but no option for removing from the
model.
Alt for (Alternative) multiple fragments; only the one whose condition is true will execute
Opt for (Optional) fragment executes only if the specified condition is true
Par for (Parallel) each of the contained fragments is run in parallel
Loop for the fragment might execute multiple times; guard indicates the basis for iteration
Note
To animate a sequence diagram automatically, set the
SequenceDiagram::General::AutoLaunchAnimation property to one of these options:
Always launches the sequence diagram automatically.
If In Scope launches animation only if the sequence diagram is in the active
component scope.
The Never option for this property prevents automatic animation and is the default.
1. Select the message in the sequence diagram, right-click, and select Add Execution
Occurrences.
2. Click the Execution Occurrences button in the Diagram Tools, then select the appropriate
message in the sequence diagram.
You can have Rational Rhapsody create execution occurrences automatically when you create
messages by setting the property
SequenceDiagram::General::AutoCreateExecutionOccurrence to Checked. Execution
occurrences are drawn at the beginning and end of the message.
If you move a message with execution occurrences or resize them so they overlap other
execution occurrences, they are “merged,” as shown in this example.
Select the execution occurrence and then click Delete (or use the Delete from Model
option in the menu)
Delete the start message (the message assigned to the execution occurrences). This
automatically deletes the execution occurrences “owned” by that message.
2. Position the mouse in the area above the classifier role names.
3. Hold down the Shift key and drag the mouse up to shift the entire diagram upward, or drag
down to shift the entire diagram downward.
2. Position the mouse above the highest element that you want to shift.
3. Hold down the Shift key and drag the mouse up to shift the element and all the elements
below it upward, or drag down to shift the element and all the elements below it
downward
2. Position the mouse to the left of the instance lines that you want to shift.
3. Hold down the Shift key and drag the mouse to the right to move all the elements on the
right side of the mouse cursor to the right. Hold down the Shift key and drag the mouse to
the left to move all the elements on the right side of the mouse cursor to the left.
Note: If you place the mouse on an instance line and drag while the Shift key is held
down, Rational Rhapsody will shift the instance lines on the right of that
instance line but not that instance line itself. “On an instance line” includes the
entire width below the box that contains the name of the classifier role.
Display options
Most of the elements that can be added to a sequence diagram have options that you can set to
affect how they are displayed in the diagram. While these options vary from element to element,
the following options are common to the System Border, Instance Line, Message, and Reply
Message elements:
To open the menu for a sequence diagram, right-click the name of the diagram. The menu contains
the following options:
Open Sequence Diagram opens the selected sequence diagram in the drawing area.
Features opens the Features window for the sequence diagram.
Features in New Window opens the Features window for the sequence diagram in a
separate window.
Add New enables you to add a new dependency (see Dependencies), annotation (see
Annotations for diagrams), hyperlink (see Hyperlinks), or tag (see Use tags to add element
information).
References enables you to search for references to the diagram in the model (see Finding
element references).
Unit enables you to either make the sequence diagram a unit that you can add to a CM
archive (Save) or modify an existing unit (Edit Unit).
Configuration Management provides access to common CM operations for the sequence
diagram, including Add to archive, Check In, Check Out, Lock, and Unlock.
Format changes the format used to draw the element (color, line style, and so on). For
more information, see Change the format of a single element.
Delete from Model deletes the sequence diagram from the entire model.
In the early system requirements phase, they are used for use case description.
In the implementation phase, they verify that all conditions are met in terms of
communication between classes.
In the testing phase, they capture the actual system trace.
Therefore, there is a need to facilitate comparison between SDs because, in principle at least, they
should be identical. The execution message sequence should match the specification message
sequence. The Sequence Diagram Comparison tool enables you to perform comparisons, for
example between hypothetical and actual message sequences. You could also use this tool to
compare two runs for regression testing.
If all execution SDs are identical to their corresponding specification (nonanimated) SDs, the
system satisfies the requirements as captured in the use cases. However, if there are differences,
you need to determine whether the specification was inaccurate or an error exists in the
implementation. In both cases, you should correct the modeling error (either in the statechart or the
SD) and then repeat the testing cycle to determine whether you have fixed the problem.
Departure time
Arrival time
Arguments
One simple approach involves comparing the exact position of every message and stopping at the
first difference. However, this is probably too naive a comparison. For example, if there is a time
offset in one SD, this kind of comparison would stop at the first message.
A more useful approach, therefore, is to take all events (message departures and arrivals) in order,
and compare them without using the exact time. This kind of comparison, although simple, still
shows when two SDs are essentially identical.
Because some messages can be “noise,” the comparison algorithm should also be able to decide
whether a message is legitimate, and if not, mark it and continue with the comparison starting with
the next message.
The point in comparing two SDs is not to show when one sequence is identical to another, but
rather where and why they are different. Therefore, yes/no answers are not sufficient. Proper
results must detail precisely what is identical and what is different. This is the approach that
Rational Rhapsody takes when comparing message sequences.
1. Select Tools > Sequence Diagram Compare. The Sequence Diagrams Comparison
window opens, as shown in the following figure.
2. Using the SD1 and SD2 list controls, select two sequence diagrams to compare.
3. Set options for the sequence comparison as wanted. See Sequence comparison options.
4. When all options are set and you are ready to start the comparison, click OK.
The result of the comparison displays as a dual-pane window with the diagram selected for SD1 on
the left, and the diagram selected for SD2 on the right. Both panes are read-only. The following
figure shows sample results.
The messages displayed in both panes are color-coded based on the comparison results. The
following table lists the color conventions used in the comparison.
Select Options in the Sequence Diagrams Comparison window to open the Sequence Diagram
Comparison options window. This window contains the following tabs:
Synchronization specifies whether to ignore the arrival times of messages. For more
information, see Ignoring message arrival times.
Save saves your option settings to a file that you can reuse. For more information, see
Saving and loading options settings.
Load loads your option file. For more information, see Saving and loading options
settings.
In the resulting comparison display, equivalent messages are vertically synchronized in the
adjacent window panes. This helps you to locate corresponding messages in both diagrams.
To enable or disable the synchronization option, select or clear the Synchronization box in the
General tab.
2. The Save As window opens. The default name for the options file is composed of the first
words of the titles of each of the diagrams being compared separated by an underscore:
<SD2>_<SD1>.sdo
The file extension .sdo stands for Sequence Diagram Options. If wanted, edit the
path and default name for the options file.
3. Click OK.
3. Click Open.
The sequence comparison options are restored to the settings last saved in the file.
On this Message Selection tab, the word “Ignore” is the default setting for the Arguments column
for all messages. This means that, by default, argument comparison is ignored for messages.
Exclude a message from the comparison (see Excluding a message in the comparison)
Compare arguments (see Comparing arguments)
3. Click the Ignore box to exclude the message from the comparison.
4. The three radio buttons, allow you to specify the way to treat Arguments associated with
the selected message.
5. Click OK.
Comparing arguments
There are two options for determining whether messages are identical: the first is to compare the
message names and all arguments, the second is to compare only the message names. The latter
option is more useful because SDs show four different kinds of arguments:
Unspecified arguments
Actual values
Formal names
Both names and values
In specification SDs, you might not always provide complete information about message
arguments. Because execution SDs record what the system actually does, they always show both
argument values and names. Therefore, the message comparison ideally should not use arguments
but rather focus primarily on message names.
When two messages are named identically, you can compare their arguments.
For example, consider messages called evDigitDialed(Digit). They would be equivalent if you
compared only their argument names (Digit). However, if you compared their values
(EvDigitDialed(Digit=0), EvDigitDialed(Digit=1), and so on), their argument values would
not be equivalent.
3. Determine whether to use the name, the value, or both for the comparison.
1. In the Message Selection tab, select a message and click Edit. The Edit Message
Compare Options window opens.
Compare Names Only compares argument names, but ignore their values.
Compare Names and Values compares both argument names and values.
These are commonly used settings:
3. Click OK.
Depending on your selections, the following labels are displayed in the Arguments
column on the Message Selection tab:
In general, requiring a complete object match between execution and specification SDs is too
rigorous a requirement. The solution is to associate objects in one SD with other objects in the
other SD. Messages can then match if their source and target objects are associated in both SDs.
To associate objects with each other you create object groups. Object groups are, in essence,
instance abstractions that bridge the gap between high-level use cases and actual implementation,
or between black-box and white-box scenarios. Using object groups, you can then compare objects
that do not have the same name, or compare one object to several other objects.
To view object groups, select the Instance Groups tab in the Sequence Diagram Comparison
options window. The Instance Groups tab, shown in the following figure, displays a list of the
existing object groups in the model. There is one object group for each object, which is, by default,
the only member of its own group.
.
The objects that belong to the group are displayed in the Objects groups list at the bottom of the
window. This means that the objects listed for SD1 are considered logically the same as those
listed for SD2.
The Instance Groups tab enables you to perform the following operations:
1. On the Instance Groups tab, click Add. The Edit Object Group window opens. The
default name for new object groups is ClassBuffn, where n is an integer starting with 1.
3. To add objects to the group, move one or more unused objects from either of the boxes on
the right to the corresponding box on the left.
4. Click OK.
1. On the Instance Groups tab, select the object group you want to delete.
2. Click Delete.
3. Click OK.
Any objects that belonged to the deleted group are now unused and available to be assigned to
another object group.
2. Click OK.
All objects are now unused and available to be assigned to a new object group.
The name of the selected object group is displayed at the top of the window. The
name box is unavailable because you cannot edit it here.
The Edit Object Group window contains four boxes. The two on the left show which
objects in SD1 will be associated with which objects in SD2. The two boxes on the
right show which objects in each diagram are currently not assigned to any group,
and are therefore available to be assigned to a group.
3. Select an object in one of the boxes on the left and click the right arrows button.
1. Select an object in one of the boxes on the right, and move it with the left arrows button.
2. Click OK. The selected object in one diagram is now available to be added to another
group.
3. On the Instance Groups tab, select the new group for the object and click Edit.
4. Select the object in the Unused Objects in SD<number> box in the lower, right corner
and click the left arrows key to add it to the group.
5. Select the object in the To Objects in SD<number> box in the lower, right corner and
click the right arrows button to remove it from the group.
6. Click OK.
To avoid this problem, the comparison must be able to ignore the timing of messages. For
example, a message M1 sent by an instance A1 after a message M2 sent by an instance A2 could
match the same message sent before M2:
A1 A2 A3 A1 A2 A3
M2 M1
M1 M2
=
There can also be cases where two or more messages should be sent at the same time, but the order
is not important. Message groups enable you to specify groups of messages for which ordering is
not important. There is a match if any message in the group occurs in any order.
The Message Groups tab, shown in the following example, enables you to create, modify, and
delete message groups.
1. On the Message Groups tab, click Add. The Edit Message Group window opens.
The default name for new message groups is MessageBuffn, where n is an integer
starting with 0.
The Edit Message Group window contains two list boxes: the left one shows the messages
that currently belong to message group, whereas the right one shows all messages in the
two SDs being compared. Messages can belong to more than one message group.
2. Select a message from the All Messages list and click the left arrows button to move it to
the Messages in group list. For multiple selections, use Shift+Click or Ctrl+Click.
3. Click OK.
2. Select a message from the Messages in group list and click the right arrows button to
move it to the All Messages list. For multiple selections, use Shift+Click or Ctrl+Click.
3. Click OK.
1. On the Message Groups tab, select a message group from the list.
The messages that belong to that group are listed at the bottom of the window, as shown in
this example.
2. Click OK.
1. On the Message Groups tab, select a message group from the list and click Edit. The Edit
Message Group window opens.
2. Select a message in the Messages in group list and click the right arrows button to remove
it from the group.
Select a message in the All Messages list and click the left arrows button to add it to the
group.
3. Click OK.
1. In the Sequence Diagram Comparison options window, select the message group to delete.
2. Click Delete.
Statecharts define the behavior of objects by specifying how they react to events or operations.
The reaction can be to perform a transition between states and possibly to execute some actions.
When running in animation mode, Rational Rhapsody highlights the transitions between states.
You can use operations and attributes in classes with statecharts to define guards and actions, as in
the following example.
States
A state is a graphical representation of the status of an object. It typically reflects a certain set of its
internal data (attributes) and relations. In statecharts, states can be broken down hierarchically as
follows:
Basic (leaf) state is a state that does not have any substates.
Or state is a state that can be broken down into exclusive substates. This means that the
object is exclusively in one or the other of its substates.
In the following example, there are possible two states: On and Off.
And state An object is in each of its substates concurrently. Each of the concurrent
substates is called an orthogonal component. You can convert an Or state to an And state
by dividing it with an And line. For more information, see And lines.
You set the statechart implementation in the Settings tab of the Configuration window in the
browser.
1. Click the appropriate button in the Diagrams toolbar to the Open Statechart window
opens for you to select the diagram.
2. For statecharts, select the class that the diagram describes from the list of available
diagrams. For all other diagrams, select the diagram you want to open.
As with other Rational Rhapsody elements, use the Features window for the diagram to edit its
features, including the name, stereotype, and description. For more information, see The Features
window.
Drawing
Name Description
Tool
State Indicates the current condition of an object, such as On or Off. For more information,
see States.
Transition Represents a message or event that cause an object to transition from one state to
another. For more information, see Transitions.
Initial connector Shows the default state of an object when first instantiated. For more information,
see Initial connectors.
Add line Separates the orthogonal components of an And state. There can be two or more
orthogonal components in a given And state and each behaves independently of the
others. For more information, see And lines.
Decision Node Shows the branches on transitions, based on Boolean conditions called guards. For
more information, see Decision nodes.
History Stores the most recent active configuration of a state. An transition to a history
connector connector restores this configuration. For more information, see History
connectors.
Termination Ends the life of the object. For more information, see Termination connectors.
connector
Merge Node Joins multiple transitions into a single, outgoing transition. For more information, see
Merge nodes.
Drawing
Name Description
Tool
Diagram Joins physically distant transition segments. Matching names on the source and
connector target diagram connectors define the jump from one segment to the next. For more
information, see Diagram connectors.
EnterExit point Represents the entry to / exit from sub-statecharts. For more information, see
EnterExit points.
Join node Merges multiple incoming transitions into a single outgoing transition. For more
information, see Activity diagrams.
Fork Node Separates a single incoming transition into multiple outgoing transitions. For more
information, see Activity diagrams.
Termination Signifies either local or global termination, depending on where they are placed in
State the diagram.
Dependency Indicates a dependent relationship between two items in the diagram. For more
information, see Activity diagrams.
Send Action Represents the sending of events to external entities. For more information, see
Send action elements.
The following sections describe how to use these tools to draw the parts of a statechart. For basic
information on diagrams, including how to create, open, and delete them, see Graphic editors.
Drawing a state
To draw a state:
2. Click-and-drag or click in the drawing area to create a state with a default name of
state_n, where n is an incremental integer starting with 0.
Must be identifiers.
Features of states
The Features window allows you to add and change the features for a state. A state has the
following General tab features:
Action on entry
The Action on Entry specifies the action that should be executed whenever the system enters this
state, regardless of how the system arrived here.
If the action on entry value is overridden, the Overridden check box is checked. The Overridden
check box is available in the Features windows for textual information in statecharts (state entry
and exit actions, and guards and actions for transitions and static reactions). By enabling or
disabling this check box, you can easily override and unoverride statechart inheritance without
actually changing the model. As you toggle the check box on and off, you can view the inherited
information in each of the window fields, and can decide whether to apply the information or
revert back to the currently overridden information. For more information, see Overriding textual
information.
Action on exit
The Action on Exit specifies the action that should be executed whenever the system exits this
state, regardless of how the system exits.
If the action on entry value is overridden, the Overridden check box is checked.
Reactions in state
The Reaction in State specifies the trigger, guard, and actions identified in an transition label. If the
trigger occurs and the guard is true, the action is executed. For more information, see Adding or
modifying activity flow labels. Use the appropriate window button:
New creates a new reaction in state. If you select this option, the Reaction Features
window opens so you can specify the Trigger, Guard, and Action for the new reaction.
Edit modifies an existing reaction.
Delete deletes a reaction.
Note: If you specify action on entry or exit behavior for a state, this icon is added to
the state display.
Termination states
A termination state provides local termination semantics. Local termination implies the
completion of a composite state without the destruction of the context instance.
Statechart mode where local termination applies only to composite states with final
activities inside them.
Activity diagram mode where local termination applies to every block and composite
state, even those that do not have internal final activities. (This is the UML statechart/
activity diagram-supported mode.)
The CG::Statechart::LocalTerminationSemantics property specifies whether activity
diagram mode of local termination is available. The default value of Cleared means that the
activity diagram mode of local termination is unavailable (statechart mode is active).
For each final activity, a Concept class data member of type FinalState is generated. A
new class is not created as for other state types.
The following local termination guard is added to each outgoing null transition from an Or
state that needs local termination semantics:
&& IS_COMPLETED(state)
If an Or state has several final activities, an outgoing null transition is activated when any
one of them is reached. However, the specific connector is instrumented.
The isCompleted() function is overridden for an Or state that has a final activity,
returning True when the final activity is reached. The function is also overridden for an
Or state without a final activity in activity diagram mode, always returning False.
An instance of a FinalState is created by a line similar to the following example:
FinalA = new FinalState(this, OrState, rootState,
“ROOT.OrState.FinalA”);
The following local termination guard is added to each outgoing null transition from an
And state if one of the components has a final activity:
&& IS_COMPLETED(AndState)
In this case, the isCompleted() function of the AndState framework class is called.
The following local termination guard is added to a join transition for each Or state that is
a source of the transition:
&& IS_COMPLETED(state)
If a source state of a join transition is a simple state (leaf state), its guard is as follows:
(IS_IN(state))
The following example shows the code generated for a join transition with a real guard and local
termination guards, where C1 and C2 are Or states with final activities and C3 is a leaf state:
if(RealGuard() && IS_COMPLETED(C1) && IS_COMPLETED(C2) && IS_IN(C3))
For each final activity, the new state enumeration value is generated (as for a regular
state).
For each Or state with a final activity, a <StateName>_isCompleted() operation is
generated. This operation returns an OMBoolean value of True when the state is
completed. If the CG::Class::IsCompletedForAllStates property is Checked, the
operation is generated for all states.
The following local termination guard is added to each outgoing null transition from an Or
state that needs local termination semantics:
&& IS_COMPLETED(state)
Instrumentation information for FinalState is generated in the transition code (as for
normal states).
The following local termination guard is added to each outgoing null transition from an
And state if one of the components has a final activity.
&& IS_COMPLETED(AndState)
In this case, the isCompleted() function of the AndState framework class is called:
The isCompleted() operation of AndState calls the IS_COMPLETED() macro for all
components that have a final activity. This operation returns TRUE only when all
components are completed. If an And state does not have components with a final
activity, the operation returns TRUE in statechart mode and FALSE in activity diagram
mode.
Implementation of join transitions with the flat statechart implementation is the same as
for the reusable statechart implementation (see And states in reusable statechart).
Transitions
A basic transition is composed of a single arrow between a source and a destination. Transitions
represent the response to a message in a given state. They show what the next state will be, given a
certain trigger. A transition can have a trigger, guard, and actions.
The transition context is the scope in which the message data (parameters) are visible. Any guard
and action inherit the context of an transition determining the parameters that can be referenced
within it.
State
Initial connector
History connector
The destination of an transition can be one of the following items:
State
Final activity
History connector
2. Click the bottom edge of the state to anchor the start of the transition.
3. Move the cursor to the top edge of the state and click to anchor the transition line.
4. In the label box, type the name of the event. Press Ctrl+Enter to terminate.
Note
Pressing Enter in an transition name, without simultaneously pressing Ctrl, simply adds a
new line.
Features of transitions
Use the Features window to add and change the features for a transition, as shown in this example.
The Overridden check box is available in the Features windows for textual information
in statecharts (state entry and exit actions, and guards and actions for transitions and static
reactions). By enabling or disabling this check box, you can easily override and
unoverride statechart inheritance without actually changing the model. As you toggle the
check box on and off, you can view the inherited information in each of the window
fields, and can decide whether to apply the information or revert back to the currently
overridden information. For more information, see Overriding textual information.
Action specifies the transition action.
Types of transitions
You can create the following types of transitions:
Compound transitions
Forks
Joins
Compound flows
A compound flow is composed of several transition segments connected by intermediate nodes. A
transition segment is a subpart of a transition between any source, destination, or intermediate
nodes.
Forks
Joins
Merge nodes
Decision nodes
Diagram connectors
In semantic terms, forks and joins can both be nodes.
Forks
A fork is a compound transition that connects a transition to more than one orthogonal destination.
The destination of a fork segment can be a state, final activity, or connector. However, it cannot
have a label, as shown in the this example.
Joins
A join is a compound transition that merges segments originating from states, final activities, or
connectors in different orthogonal components. Rational Rhapsody automatically generates a join
when you combine source segments. The segments entering a join connector should not have
labels, as shown in the following figure.
Note
If the model contains joins from more than two concurrent states, this generates an error. This is a
Rational Rhapsody limitation in that the error is a violation of MISRA rule 33.
Notice that if there are more triggers that can appear on the pop-up menu, a Browse command
displays. Click Browse to open the Select Trigger window that shows you all the triggers that are
available.
Transition labels
Transition labels can contain the following parts:
Triggers
Guards
Actions
The syntax for transitions is as follows:
trigger [guard] /action
The following example shows a transition label consisting of a timeout trigger (see Timeouts), a
guard, and an action:
tm(500)[isOk()]/printf("a 0.5 second timeout occurred\n")
In this example, the trigger is the timeout tm(500) and the guard is [isOk()]. The action to be
performed if the trigger occurs and the guard is true is printf("a 0.5 second timeout
occurred\n").
All three parts of the transition are optional. For example, you can have a transition with only a
trigger and an action, or only a guard. The following example shows a transition label consisting of
only a trigger and an action:
clockw /itsEngine->GEN(start)
When typing a multiline transition label (for example, one that has several actions separated by
semicolons), you can press Ctrl+Enter to advance the cursor to the next line and continue the
label.
Triggers
Every transition is associated with a designated message, which is the trigger of the transition. In
other words, the trigger of the transition is waiting for its event. A transition cannot be associated
with more than one message. Triggers can be events, triggered operations, or timeouts.
Events are asynchronous; time can pass between the sending of the event and when it actually
affects the statechart of the destination. Triggered operations are synchronous; their effect on the
statechart of the destination is immediate.
Events
Events originate in the analysis process as “happenings” within the system to which objects
respond. Their concrete realizations are information entities carrying data about the occurrence
they describe.
An event name
The name of a triggered operation
tm(time expression)
Event usage
Classes and their statecharts can receive events defined in any package in the model. Cross-
package inheritance of statecharts for reactive classes is not allowed.
For example, windowing systems define several event classes: MouseEvent is a subclass of
InputEvent, and MouseClickEvent and MouseMotionEvent are subclasses of MouseEvent.
2. From the Inherits: list, select the event that is to serve as the base class.
Generating events
You generate an event by applying a gen method on the destination object, as follows:
client->gen(new event(p1,p2,...,pn))
The generate method queues the event on the proper event queue.
The framework provides a GEN macro, which saves you from having to use the new operator to
generate an event. For example:
client->GEN(event(p1, p2, pN))
Event semantics
An event is created when it is sent by one object to another, then queued on the queue of the target
object thread (thread partitioning is not covered in this guide). An event that gets to the head of the
queue is dispatched to the target object. Once dispatched to an object, it is processed by the object
according to the semantics of event propagation in statecharts and the run-to-completion
semantics. After the event is processed, it no longer exists and the execution framework implicitly
deletes it.
Internal events
An internal event occurs when an object sends a message to itself. To create an internal event, omit
the destination object from the send operation, as follows:
GEN(warmEngine(95))
Private events
You can control which classes can generate events to which classes using friendship. In this way,
you can ensure that events come from trusted classes only. The event request and queueing
function is controlled by the gen() methods, which are public by default in the framework base
class OMReactive. If you want to control the generation of events using friendship, make the first
gen() method in Share\oxf\OMReactive.h protected. This is a one-time effort. Do not change
the second gen() method, which is used for instrumentation.
Inside each application class, grant friendship to the classes that need to generate events for it. If
you do not grant friendship, your program will no longer compile.
To add an operation to an event, right-click the event in the browser and select Add New >
Operation.
The new operation displays below the event in the browser, and when code is generated, the
operation displays in the class that represents the event.
Note
Roundtripping does not bring into the model any new operations that you have added to
event classes in your code, nor does it bring into the model changes that were made directly
to the body of operations that were previously created for events.
Triggered operations
Triggered operations are services provided by a class to serve other classes. They provide
synchronous communication between a client and a server object. Because its activation is
synchronous, a triggered operation can return a value to the client object.
Unlike events, operations are not independent entities; they are part of a class definition. This
means that operations are not organized in hierarchies.
The usage of operations corresponds to invocation of class methods in C++. There are three
reasons why operations have been integrated with the statechart framework:
They allow use of statecharts in architectures that are not event-driven to specify
behaviors of objects in the programming sense of operations and object state.
They provide for late design decisions to optimize execution time and sequencing by
converting event communication into direct operation invocations.
They allow the description of behaviors of (primitive) “passive” classes using statecharts.
Operation replies
Operations can return a value. The return value for an operation m must be determined within the
transition whose context is the message m, using the reply operation:
m/reply(7);
Note
A triggered operation might not result in another triggered operation on the same instance.
Rather than use the IS_IN macro to determine what state the receiver is in, you can design your
statechart so the triggered operation is never ignored. To do this, create a superstate encompassing
the substates in the object, and in the superstate create a static reaction with a trigger to return the
proper value. For example, to make sure that a sensor is always read regardless of what state an
object is in, create a static reaction in the superstate with the following transition:
opRead/reply(getStatus())
This way, no matter what substate the object is in, it will always return the proper value. Although
both the trigger to the superstate and that to a substate are active when in a substate, the trigger on
the transition to the superstate is taken because it is higher priority. See Transition selection.
Timeouts
Timeout triggers have the syntax tm(<expression>), where <expression> is the number of time
units. The default time unit is milliseconds. The time units are set based on the operating system
adapter implementation of the tick timer. A timeout is scheduled when the origin state (s1) is
entered. If the origin state has exited before the timeout was consumed, the timeout is canceled.
You can use the timeouts mechanism (tm()) when the quality of service (QOS) accuracy
requirement conforms with the following timeout accuracy. When a timeout occurs, it is inserted
to the event queue related to the reactive instance. The time on which the timeout is consumed
depends on the actual system state. The timeout occurrence depends on three factors:
The resolution specifies how often the system checks if there are expired timeouts.
The tick timer implementation for some operating system adapters is synchronous
(using a call to sleep(interval)). This means that there is a built-in latency (the
time spent processing the expired timeouts). This latency can be significant when the
timeout is very long (involving many timer ticks).
Note: If you use triggered operations and events (including timeouts) in the same
statechart and the triggered operation can be called from an object running in a
thread other than the event consumption thread, it might lead to a race
situation. To prevent the race, make the triggered operations guarded (which
will also prevent the race with timeouts).
Null transitions
In some cases, it is useful to use a transition to leave a state without using a trigger. These are
examples of such cases:
You can modify the maxNullSteps number and recompile the framework if you need to change
the number.
Guards
A guard is a conditional expression that is evaluated based on object attributes and event data.
Rational Rhapsody does not interpret guards. They are host-language expressions, or simply code
chunks, that must resolve to either a Boolean or an integer value that can be tested. Otherwise, the
statechart code generated for guards will not compile.
The following example shows a transition label that consists of a guard and an action that uses the
GEN macro to generate an event:
[x > 7]/controller->GEN(A7Failures)
A transition can consist of only a guard. The low-to-high transition of the condition (or Boolean
value) is considered to be the triggering event. For example, the following guard is a valid
transition label:
[x > 7]
During animation, all guards without triggers are tested every time an event happens. The
following statechart uses several guards without transitions.
This statechart is for the keypad of a home alarm system. When the keypad of the alarm system is
in the idle state, you can enter a code to arm the alarm before leaving the house. After entering the
code, you press the On button to turn the alarm on. Pressing the On button issues an evKeyOn
event. Each time this event occurs, the state machine evaluates the two guards that come after the
decision node, [IS_IN(correct)] or [IS_IN(notEntered)], and follows the path of the one that
evaluates to true.
By using an animated sequence diagram, you can see when a guard is tested. If you want to test a
condition more frequently or at a more regular interval than whenever an event occurs, you can
create a polling mechanism. To do this, create a short timeout transition from the state to itself so
the guard is evaluated on at least these occasions. Alternatively, you can poll using another object
and replace the guard in the current statechart with an event signaled from the polling object.
Note
Using guards that cause side-effects is not typical, because it might cause problems in the
application.
Actions
An action expression is a sequence of statements. Like guards, actions are uninterpreted code
chunks based on object attributes and event data.
There is no need to add a semicolon to the last statement; Rational Rhapsody adds one for you.
Therefore, there is no need for any semicolon if there is only one statement.
The following example shows a transition label consisting of a trigger and an action sequence with
more than one step:
e1/x=1;y=2 // comments are allowed
Action expressions must be syntactically legal in the programming language. This means they
must be written within the context of the owner class (the one that owns the statechart being
described). Therefore, all identifiers must be one of the following items:
Actions can reference the parameters of an event or operation as defined by the transition context,
using the pseudo-variable params->. See also Message parameters.
Initial connectors
An initial connector leads into the state (or substate of an Or state, or component of an And state)
that should be entered by default. Each Or state must designate one of its substates as the default
for that state. The default state is indicated using an initial connector, of which there can be only
one per Or state. The initial connector target should be a substate of the Or state to which it
belongs.
The initial connector cannot have a trigger or a guard, although it can have an action. It might
connect to a decision node following which there might be guards.
Entry action where an expression executed upon entrance to the state (uninterpreted by
Rational Rhapsody). Note that an uninterpreted expression is resolved by the compiler,
not by the tool.
Exit action where an expression executed upon exit from the state (uninterpreted by
Rational Rhapsody).
Static reactions where actions performed inside a state in response to a triggering event/
operation. The reaction can be guarded by a condition. A static reaction does not change
the active state configuration.
Note
When a state contains an entry action, exit action, or static reaction, an icon displays in
the top-right corner of the state. This icon can be used to toggle the display of these actions
in the state.
In Rational Rhapsody, both events and messages create operations for a class. You can edit the
operations created as a result of messages, but you cannot modify any event handlers.
Events and operations relate statecharts to the rest of the model by triggering transitions.
Operations specified by a statechart are called triggered operations (as opposed to operations
specified in OMDs, called primitive operations).
In the rest of this guide, the term message means either an event or an operation.
Statecharts can react to operations and events that are part of the interface of a reactive class.
Using a message as a trigger in a statechart to transition from state S1 to state S2 means that if the
object is in S1 when it receives the message, it transitions to S2.
Events that do not trigger an active transition are ignored and discarded. If the object happens to be
in state S3 when it receives the message and S3 does not reference the message, it ignores the
message.
This feature applies to multiple address spaces on the same computer. It is not possible to send
events to reactive instances on a different computer.
INTEGRITY5
VxWorks6.2diab_RTP
VxWorks6.2gnu_RTP
Note
Currently, the multiple address space feature applies only to Rational Rhapsody in C.
Use of this feature requires:
C_CG::Configuration::MultipleAddressSpaces
When this boolean property is set to Checked, Rational Rhapsody uses the code
generation settings required for use of the multiple address space feature. The default
value of this property is Cleared, so you must change the value to enable this feature.
In order to be able to receive events from other address spaces, the reactive object must publish the
name by which it will be identified. The following two properties, set at the class level, are used
for this purpose:
C_CG::Class::PublishedName
This is the name that will be used to identify the reactive object in order to send a
distributed event to it.
If there is only one reactive instance of the class, the value of this property is used to
identify the object.
If there is more than one reactive instance of the class, each named explicitly, the name
used to identify the reactive object will be the name that you have given to the object, and
not the property value.
In the case of multiplicity, where the objects are not named explicitly, the name used to
identify the reactive object will be the published name + the index of the object, for
example, if the value of the property PublishedName is truck, then the objects would be
identified by truck[0], truck[1]...
C_CG::Class::PublishInstance
This boolean property indicates whether or not the object should be published as a
reactive instance that is capable of receiving distributed events.
In addition, the following property, which is set at the configuration level, allows you to specify a
specific target address space when sending events, as described in API for sending events across
address spaces:
C_CG::Configuration::AddressSpaceName
When you want to send an event to a reactive object in a specific address space, you
specify the address space by using the value of this property as a prefix, using the format
addressSpaceName::publishedNameOfReactiveObject. The default value of this
property is the name of the relevant component.
If the events to be sent across address spaces have no arguments or only primitive types as
arguments, such as integers or chars, it is sufficient to just set the above properties. However, if the
events to be sent include objects as arguments, you must also set the following properties at the
event level:
C_CG::Event::SerializationFunction
Name of user-provided serialization function to use
C_CG::Event::UnserializationFunction
Name of user-provided unserialization function to use
For details regarding the required structure for these two user-provided functions, see Functions for
serialization/unserialization.
Note
When providing the strReactiveName parameter for the function
RidSendRemoteEvent, you can indicate which address space contains the target object,
For convenience, Rational Rhapsody includes a macro named RiCGENREMOTE, which calls the
function RidSendRemoteEvent:
RiCGENREMOTE ([string - the published name of the destination reactive object], [type of event
with parameters in parentheses])
For example:
RiCGENREMOTE(“destinationObject”, Fstarted());
Serialization function
RhpAddress evStartSerialize(struct RiCEvent_t* const ev, const RhpAddress
buffer, RhpPositive bufferSize, RhpPositive* resultBufferSize);
return value - pointer to the serialized event
buffer - a local buffer that can be used for storing the serialized event (the user can allocate
their own buffer instead)
resultBufferSize - pointer for storing the size of the returned serialized event
Unserialization function
RiCEvent_t* evStartUnserialize(RhpAddress const serializedBuffer, RhpPositive
serializedBufferSize);
return value - pointer to the unserialized event
The function below uses a local buffer called receivedBuffer to store the string of the event
evStart which was passed as a parameter.
RiCEvent* evStartUnserialize(RhpAddress const serializedBuffer,
RhpPositive serializedBufferSize) {
/* copy the message to a local buffer */
memcpy(receivedBuffer, serializedBuffer, serializedBufferSize);
return (RiCEvent*)RiC_Create_evStart(receivedBuffer);
}
The Send Action button can be used in statecharts, activity diagrams, and flow charts to
represent the sending events to external entities.
The Send Action element can be used to specify the following actions:
Event to send
Event target
Values for event arguments
This is a language-independent element, which is translated into the relevant implementation
language during code generation.
Note
Code can be generated for Send Action elements in C, C++, and Java.
Using the Target list, select the object that is to receive the event.
Using the Event list, select the event that should be sent.
Provide values for the event arguments by selecting the argument in the argument list and
clicking the Value column.
Note
In cases where there are a number of objects based on the same class, you need to provide
additional information after selecting the target from the list. For cases of simple
multiplicity, you must provide the array index to specify the object that receives the event.
In the case of qualified associations, you need to provide the qualifier value for the object
that is to receive the event.
The Preview text box displays the text that is displayed on the element if you select full notation as
the display option to use.
The target list includes all objects known to the class for the statechart. You can choose the name
of the target object, or the name of a port on the target object.
You can click the button next to the Target list to open the Features window of the relationship
with the target object. Similarly, you can click the button next to the Event list to open the Features
window for the selected event.
While the graphical behavior of Send Action elements is similar to that of states, it should be
remembered that semantically these elements are not states. For example, you cannot put a
condition on the transition out of a Send Action element (it is an automatic transition).
For each language, code generation for this element is determined by the following properties
Note
Rational Rhapsody does not support roundtripping for Send Action elements.
And lines
An And line is a dotted line that separates the orthogonal components of an And state. There can
be two or more orthogonal components in a given And state and each behaves independently of the
others. If the system is in an And state, it is also simultaneously in a substate of each orthogonal
component.
2. Click in the middle of the upper edge of the state to anchor the start of the And line.
3. Move the cursor down to the bottom edge of the state and click to anchor the end of the
And line. Rational Rhapsody draws a dotted line that divides the state into two halves
(orthogonal states), as shown in the following figure.
Note that the state label, which used to be inside the state, has moved outside into a tab-like
rectangle.
Connectors
Rational Rhapsody supports the following connectors:
Decision nodes
History connectors
Merge nodes
Diagram connectors
Termination connectors
EnterExit points
Rational Rhapsody includes connector information for diagram, condition, and EnterExit points in
its repository (core). This means that:
Decision nodes
Decision Nodes split a single segment into several branches. Branches are labeled with guards that
determine which branch is active.
Else branches
A guard called [else] is active if all the guards on the other branches are false. Each decision
node can have only one else branch.
History connectors
History connectors store the most recent active configuration of a state and its substates. Once an
object is created, it is associated with a configuration for an active state, starting in the initial
configuration, and evolving as the statechart responds to messages.
When a transition is attached to a history connector and that transition is triggered, the state
containing the history connector recalls its last active configuration. A state can have a single
history connector.
Transitions from a history connector are constrained to a destination on the same level as the
history connector.
Note
Do not put more than one history connector in a state. Rational Rhapsody allows you to
draw more than one history connector in a state; however, the code generator does not
support this.
A state might have a history property used for recalling the recent active configuration of the state
and its substates. Transitioning into a history connector associated with the state recalls the last
active configuration.
A transition originating from the history connector designates the history default state. The default
history state is taken if no history existed prior to the history enter.
Merge nodes
A merge node combines several segments into one outgoing segment, as shown in the following
figure.
This means that segments share the same line and a common transition suffix. The segments end
up sharing the same transition line.
Diagram connectors
A diagram connector functions similarly to a merge node in that it joins several segments in the
same statechart. Diagram connectors enable you to jump to different parts of a diagram without
drawing spaghetti transitions. This helps avoid cluttering the statechart. The jump is defined by
matching names on the source and target diagram connectors.
Note
You can rename diagram connectors, and the checks are performed during code generation.
Diagram connectors should either have input transitions or a single outgoing transition. A
statechart can have at most one target diagram connector of each label, but it can have several
source diagram connectors with the same label.
During code generation, Rational Rhapsody flattens all junctions and diagram connectors by
merging the common suffix to each segment entering the connector.
In both diagram and merge nodes, a label that belongs to an incoming segment is shared and
duplicated during code generation among outgoing segments of that connector. Rational Rhapsody
merges the guards (conjunction), then concatenates the actions.
Note
Both incoming and outgoing transitions cannot have labels. If you label the incoming
transitions, do not label the outgoing transition because its label will override the label of
the incoming transition and negate any action or trigger associated with the incoming
transition.
Diagram connectors connect different sections of the same statechart, whereas EnterExit points
connect different statecharts. See EnterExit points.
Termination connectors
The termination connector is the suicide or self-destruct connector. If a transition to a termination
connector is taken, the instance deletes itself. A termination connector cannot have an outgoing
transition.
EnterExit points
EnterExit points are used to represent the entry to / exit from sub-statecharts.
At the level of the parent state, these points represent entry to / exit from the various contained
substates without revealing any information about the specific substate that the transition connects
to.
At the level of the sub-statechart, these points represent the entries to / exits from the parent state
vis-a-vis the other elements in the statechart.
When you create a sub-statechart from a parent that contains deep transitions (that is, transitions
entering one of the substates), EnterExit points are automatically created on the borders of the
parent state in both the sub-statechart and the original statechart.
Once the sub-statechart has been created, you can add additional deep transitions as follows:
2. Add a corresponding EnterExit point in the sub-statechart (manually or using the Update
feature - see Updating EnterExit points).
Alternatively, you can have Rational Rhapsody automatically update the EnterExit points:
1. Add one or more EnterExit points to the parent state in either the original statechart or the
sub-statechart.
Submachines
Submachines enable you to manage the complexity of large statecharts by decomposition. The
original statechart is called the parent, whereas the decomposed part is called the submachine.
Creating a submachine
You can create a submachine from a complex state using either the Edit menu or the menu for the
state.
To create a submachine. on a statechart, right-click a state and then select Create Sub-Statechart.
Rational Rhapsody creates a submachine called <class>.<state>, which is a new statechart
consisting of the submachine state and its contents.
If you decompose the doorClosed state into a submachine, Rational Rhapsody creates a new
submachine.
Actions and reactions move into the top state of the submachine if the transition goes to the
submachine state, and inside the submachine if the transition goes into the nested part.
Note
You cannot create submachines of inherited states. The workaround is to add a dummy state
as a child of the inherited state and make that the submachine state.
Similarly, to open a parent statechart from a submachine, right-click the top state and select Open
Parent Statechart.
Deep transitions
A deep transition is a cross-chart transition, for example, from a parent statechart into a
submachine, or vice versa. When you create a submachine, deep transitions are automatically split
via substates.
This statechart has a deep transition that crosses the edge of a parent state (running) and leads into
a nested state (on).
If you make a submachine of the running state, the deep transition is automatically split via
matching EnterExit points created in the parent statechart and submachine, as shown in this
example.
Statechart semantics
The following sections describe the object-oriented interpretation of statecharts.
Message processing by a statechart is partitioned into steps. In each step, a message is dispatched
to the statechart for processing.
Once a message is dispatched, it might enable transitions triggered by the message. Each
orthogonal component can fire one transition at most as a result of the message dispatch.
Conflicting transitions will not fire in the same step.
The order in which selected transitions fire is not defined. It is based on an arbitrary traversal that
is not explicitly defined by the statechart.
Each component can execute one transition as a result of the message. Once all components
complete executing the transition, the message is said to be consumed, and the step terminates.
After reacting to a message, the statechart might reach a state configuration in which some of the
states have outgoing, active null transitions (transient configurations). In this case, further steps
need to be taken until the statechart reaches a stable state configuration (no more transitions are
active). Null transitions are triggered by null events, which are dispatched to the statechart
whenever a transient-configuration is encountered. Null events are dispatched in a series of steps
until a stable configuration is reached. Once a stable configuration is reached, the reaction to the
message is completed, control returns to the dispatcher, and new messages can be dispatched.
Note
Theoretically, it is possible that the statechart will never reach a stable configuration. The
practical solution is to set a limit to the maximum number of steps allowed for a statechart
to reach a stable configuration. In the current implementation, reaching the maximum
number of steps is treated as if the message processing has been completed.
Active transitions
A transition is active if:
The trigger matches the message posted to the statechart. (Null triggers match the null
event.)
There is a path from the source to the target states where all the guards are satisfied
(evaluate to true).
Note
Guards are evaluated before invoking any action related to the transition.
Because guards are not interpreted, their evaluation might include expressions that cause side
effects. Avoid creating guards that might cause side effects. Guard evaluation strategy is
intentionally undefined as to when guards are evaluated and in which order.
Transition selection
Transition selection specifies which subset of active transitions should fire. Two factors are
considered:
Conflicts
Priorities
Conflicts
Two transitions are said to conflict if both cause the same state to exit. Only orthogonal or
independent transitions fire simultaneously. This means that interleaved execution causes
equivalent results. Disjoint exit states are a satisfactory condition for equivalent results.
Note: With regard to conflicts, static reactions are treated as transitions that exit and
enter the state on which they are defined.
Priorities
Priorities resolve some, but not all, transition conflicts. Rational Rhapsody uses state hierarchies
to define priorities among conflicting transitions. However, lower-level (nested) states can
override behaviors, thus implying higher priority.
The priority for a transition is based on its source state. Priorities are assigned to join transitions
based on their lower source state.
For example, if transition t1 has a source state of s1 and transition t2 has a source state of s2,:
If states s1 and s2 are not hierarchically related, relative priorities between t1 and t2 are
undefined.
Rational Rhapsody does not define a priority with regard to events and transitions other than
arrival order. If two transitions within the same orthogonal component are both active (ready to
fire), as can happen with non-orthogonal guards, only one of them will actually fire, but statecharts
do not specify which one it will be.
Active states are traversed bottom-up where transitions related to each are evaluated. This
traversal guarantees that the priority principle is not violated. The only issue is resolving transition
conflicts across orthogonal states. This is solved by “locking” each And state once a transition is
fired inside one of its components. The bottom-up traversal and the And state locking together
guarantee a proper selection set.
Transition execution
Once a transition is active and selected to fire, there is an implied action sequencing:
States are exited and their exit actions are executed, where deeper states are exited before
their parent states. In case of orthogonal components, the order among orthogonal siblings
is undetermined.
Actions sequencing follow the direction of the transition. The closer the action to the
source state, the earlier it is evaluated.
Target states are entered and their entry actions are executed, where parent states are
entered before substates. In the case of orthogonal components, the entry order is
undetermined.
Single-action statecharts
Rational Rhapsody cannot interpret simple statecharts that execute a single action and then
terminate. For example, if you represent a task as an active class with a simple statechart that
essentially executes a single action and terminates, you might be tempted to draw your statechart,
as shown in this example.
The Rational Rhapsody framework does not allow an active instance to terminate on the
initial run-to-completion (RTC) step. In other words, the startBehavior() call cannot
end with a destroyed object.
The startBehavior() call executes the initial step on the creator thread, not as part of the
instance thread. The instance thread processes events following the initial step. In this
statechart, the doIt() operation is executed on the creator thread, which is probably not
what was expected.
The workaround is to create a dummy action on the initial connector that leads into a transition.
This action can run on the instance thread and thus terminate normally.
For example, the following statechart postpones the execution of the action until the thread is
ready to process it.
Inherited statecharts
Statechart inheritance begins when a class derives from a superclass that has a statechart. The
statechart of the subclass, the inherited statechart, is initially a clone of that of the superclass. With
the exception of the items listed below, you can add things to an inherited statechart to override
behavior in the inherited class.
You cannot make the following changes to items in the statechart of a subclass:
Change anything that does not affect the model, such as moving things in the diagram
without actually editing.
Add objects to a state.
Add more states, but not re-parent states.
Attach a transition to a different target.
An inherited statechart consists of all the items inherited from the superclass, as well as modified
and added elements.
Note
It is possible to inherit statecharts across packages.
If you edit a base statechart, the derived statechart is redrawn only on demand at checks, code
generation, report generation, or the opening of a derived statechart.
Types of inheritance
Each item in the derived statechart can be:
Inherited where any modifications to an item in the superclass is applied to the item in the
subclass.
Overridden where any modifications to an item in the superclass do not apply to the
subclass. However, deleting an item from the superclass also deletes the item from the
subclass. This is different from C++, for example, where deleting an overridden behavior
in the superclass causes the overridden behavior to become a regular item.
Regular where regular items are owned by the subclass. The item is not related to the
superclass and is not affected by the superclass.
Noting the status of items as inherited, overridden, or regular is crucial both for Rational Rhapsody
and the user.
Note
The current implementation of statechart inheritance is restricted to single inheritance. A
reactive class can have at most one reactive superclass.
Inheritance rules
Classes with inherited statecharts can reside in different packages. A class with a statechart
(reactive class) can inherit from a class without a statechart. Multiple inheritance of reactive
classes (with statecharts) is not supported. Derived classes can inherit from multiple primitive
classes. Rearranging inheritance hierarchies of reactive classes is not supported.
There are different inheritance rules for states, transitions, triggers, guards, and actions.
You can add states to the derived statechart, as long as they do not violate the hierarchy in the
statechart of the superclass. In practice, this means that a regular state cannot contain inherited
substates.
In the following example, the leaf state s2 was refined and became an Or state. The states s1 and
s2 on the right are the inherited states.
You can add And lines to inherited states (adding components). If you convert an inherited Or state
into an And state, the Or state becomes an And state, and one of the components contains its
substates. This is an exception to the previous rule, where the state hierarchy is modified by
introducing an orthogonal component. The component that re-parents the substates is designated
as “main.” In the following example, s2 becomes an And state. The component containing s3 and
s4 is the main component. The name of a component is the same as the name for the And state.
You cannot modify triggers. They are inherited from the superclass.
You can modify actions and guards.
You can override a guard, but still get changes on the action.
Modifications to the label of the corresponding segment in the superclass no longer affect the
subclass.
Note
The inheritance color coding of the label and the segment are independent. The label can be
overridden while the segment is still inherited, and vice versa.
Currently, there is no inheritance color coding for static reactions. In addition, tracing inherited
actions between the superclass and the derived statechart is done implicitly by Rational Rhapsody
and is not visible.
In a dual-speed blower, the On state is refined to include Fast and Slow modes, as shown in the
following figure.
If you make the On state into an And state, you can add a heat mode, as shown.
Once you have overridden inheritance, the derived statechart becomes independent from its parent
and you can modify it without constraint. In addition, colors are no longer gray. They are the usual
statechart colors.
To undo the inheritance override, right-click in the statechart and select Unoverride Inheritance.
Note that if you override the textual information, the display colors and statechart change as
follows:
If you unoverride the textual information of a transition or state, the label color reverts to
gray.
If you unoverride a transition target, the transition color reverts to gray and the graphics
are synchronized to the new target.
For example, suppose you have class C inheriting from class A, as shown in the following OMD.
Suppose you want to change the hierarchy so C inherits from B, which in turn inherits from A.
Therefore:
The statechart that C inherited from A will now be inherited from B; B will inherit its
statechart from A.
The inheritance between A and C will be deleted.
C will not lose any information, because its inherited elements will reference new GUIds.
To make these changes:
1. Using either the browser or the Diagram Tools, create inheritance between B and A.
IS_IN Query
The Rational Rhapsody framework provides the query function IS_IN(state), which returns a
true value if the state is in the current active configuration.
IS_IN(state) returns true if the state is in the active configuration at the beginning of the
step. For states entered in a step, IS_IN(state) returns false, unless the states are being
re-entered.
The state name passed to IS_IN() is the implementation name, which might be different
from the state name if it is not unique.
For example, the following state names are generated for the statechart shown in the
figure:
State* B; State* B_A2; State* B_A1;
State* A; State* A2; State* A1;
The implementation name of A1 in state A is simply A1 because it was drawn first. The
implementation name of A1 in state B is B_A1, because it is a duplicate.
In the following statechart, the transition to substate A4 in state A is taken only if the object is still
in substate A1 in A after one second. The transition to substate A4 in state B is taken only if the
object is still in substate A1 in B after two seconds.
In these two cases, the IS_IN() query requires the use of the implementation names A1 and B_A1
to differentiate between like-named substates of two different states.
The IS_IN macro is called as if it were a member operation of a class. If you want to test the state
of another class (for example, a relation), you must use the relation name. For example, if you have
a relation to a class A called itsA and you want to see if A is in the idle state, you would use itsA-
>IS_IN(idle) rather than A->IS_IN(idle).
Message parameters
Message data are formal parameters used within the transition context. By default, if the message
is an event, the names of message parameters are the same as the arguments (data members) of the
event class.
You reference event arguments in a statechart using the pseudo-variable params-> with the
following syntax:
event/params->event_arg1, params->event_arg2
Consider a class Firecracker that processes an event discharge, which has an argument color.
The argument color is of an enumerated type Colors, with the possible values red (0), green (1),
or blue (2). In the statechart, you would indicate that you want to pass a color to the event when it
occurs using the following label on the transition:
discharge/params->color
When you run the application with animation, you can generate a discharge event and pass it the
value red by typing the following command in the animation command field:
Firecracker[0]->GEN(discharge(red))
The application understands red as a value being passed to the argument color of event
discharge because of the notation params->color. The color red is translated to its integer value
(0), and the event is entered on the event queue of the main thread as follows:
Firecracker[0]->discharge((int)color = 0)
Finally, the event queue processes the event discharge with the value red passed via params->.
The Firecracker explodes in red and transitions from the ready to the discharged state.
The way the params-> mechanism works is as follows: When you create an event and give it
arguments, Rational Rhapsody generates an event class (derived from OMEvent) with the
arguments as its attributes. Code for events is generated in the package file.
The following sample code shows the event discharge, which has one argument called color.
The code was generated in the header file for the Default package:
//-------------------------------------------------------
// Default.h
//-------------------------------------------------------
class discharge;
class Firecracker;
enum Colors {red, green, blue};
class discharge : public OMEvent {
DECLARE_META_EVENT
//// User explicit entries ////
public :
Colors color;
//// User implicit entries ////
public :
// Constructors and destructors:
discharge();
//// Framework entries ////
public :
discharge(Colors p_color);
// This constructor is need in code instrumentation
discharge(int p_color);
};
When the Firecracker event queue is ready to take the event discharge, it calls
SETPARAMS(discharge). SETPARAMS is a macro defined in oxf\state.h as follows:
This means that if you are defining your continuous behavior elements manually, you can continue
to do so. If you are using another tool to define your continuous behavior and that tool generates
code, you can include that code.
Interrupt handlers
The ability to add an interrupt handler depends on operating system support. Typically, a static
function without parameters is added by passing its address to an operating system operation like
InstallIntHdlr (operating system-dependent). The static function can be either a special
singleton object or a function defined within a package. This operation must use compiler-specific
utilities to get to the registers. Eventually, it must return and execute a return from the interrupt
instruction.
You can pass the data from the interrupt handler to the CPU (assuming that the interrupt handler
needs to), in the following ways:
Generate an event (using the GEN() macro), which then goes via the operating system to
the reactive object (which should be in a different thread).
Use a rendezvous object with a read/write toggle lock. The interrupt handler checks
whether the lock is in the write state, then updates the data and puts the lock in the read
state. The reader (in another thread) periodically checks the lock and only reads when it is
in the read state. If it is in that state, the reader reads the data and updates the lock to its
write state. This can easily be extended to a queue structure.
Write the interrupt handler manually outside Rational Rhapsody and send it to the
operating system message queue for the target thread. Typically, if the operating system
does not support interrupt handlers directly, you store the current handler in your function
and write the address of the function in the appropriate place in the interrupt vector table.
When the interrupt goes off, either the new function replaces the old interrupt handler
(meaning when it is done it simply returns) or it chains to it (calls the original). In any
event, when the interrupt handler is decommissioned, you replace the vector in the vector
table with the original address.
When you implement this statechart using the flat scheme, you should expect the following
methods to be added to the class and called through a series of a few function calls from
rootState_dispatchEvent():
int MyClass::s2TakeNull() {
int res = eventNotConsumed;
s2_exit();
//#[ transition 2
f2();
f2();
//#]
s3_entDef();
res = eventConsumed;
return res;
};
int MyClass::s1TakeNull() {
int res = eventNotConsumed;
s1_exit();
//#[ transition 1
f1();
f1();
//#]
s2_entDef();
res = eventConsumed;
return res;
};
In fact, what happens is that the transition code (between the //#[ and //#] brackets) is
immediately inlined (embedded) inside rootState_dispatchEvent(), as follows:
int MyClass::rootState_dispatchEvent(short id) {
int res = eventNotConsumed;
switch(rootState_active) {
case s1:
{
if(id == Null_id)
{
popNullConfig();
//#[ transition 1
f1();
f1();
//#]
pushNullConfig();
rootState_subState = s2;
rootState_active = s2;
res = eventConsumed;
}
break;
};
case s2:
{
if(id == Null_id)
{
popNullConfig();
//#[ transition 2
f2();
f2();
//#]
rootState_subState = s3;
rootState_active = s3;
res = eventConsumed;
}
break;
};
};
return res;
};
This code is more efficient because it saves a few function calls via inlining of code. Inlining is
available using the CG::Class::ComplexityForInlining property of the class, which is set to 3
by default. This means that if the user code (the action part of the transition) is shorter than three
lines, it is inlined (or embedded) where the function call used to be instead of the function call. To
get the “expected” result (not inlined), set this property to 0.
Tabular statecharts
In addition to viewing statecharts as diagrams, it is possible to view statecharts in a tabular format.
You can also make certain types of changes to your statechart when using the tabular view.
Table cells display the new state the application will enter when the relevant trigger
occurs.
The table contains a column named Null which is used for transitions not associated with a
specific trigger.
For an And state, each of the substates is listed in its own row, nested below the And state.
Diagram connectors do not appear in the table. Rather, the resulting transition between
states is shown.
The following statechart elements appear as rows in the table: condition connectors,
history connectors, junction connectors, join bars and fork bars.
Enter/Exit points appear as rows in the table, nested under their owner state.
Default connectors (transitions) are depicted as outgoing transitions from a state called
ROOT.
Add transitions
Add events
Delete transitions
Delete events
Delete states
Adding a transition
To add a new transition to the table:
Select the name of the target state and drag it to the table cell where the row of the source state
intersects the column of the relevant trigger.
Select the name of the target state and drag it to the table cell where the row of the source state
intersects the NULL column.
Select the name of the target state and drag it to the table cell where the ROOT row intersects the
Initial column.
Adding an event
To add an event when in tabular view, click the Add model element button on the toolbar. The
Add new element window will be displayed, allowing you to create one or more new events.
1. Select the relevant transition cell, event header, or row name in the table.
Note
You cannot delete the ROOT state.
A panel diagram provides you with a number of graphical control elements that you can use to
create a graphical user interface (GUI) to monitor and regulate an application. Each control
element can be bound to a model element (attribute/event/state). During animation, you can use the
animated panel diagram to monitor (read) and regulate (change values/send events) your user
application. For more information about animation, see Animation.
This feature provides a convenient way to demonstrate the design and, additionally, provides you
with an easy way to create a debug interface for the design.
Note
The panel diagram feature is only available for Rational Rhapsody in C and Rational
Rhapsody in C++.
You can use a panel diagram to create the following types of panels for design and testing
purposes:
Hardware control panel designed for operating and monitoring machinery or instruments.
Software graphical user interface (GUI) for display on a computer screen allowing the
computer application user easier access to the application function than would be required
if the user entered commands or other direct operational techniques.
Note
Panel diagrams are intended only for simulating and prototyping, and not for use as a
production interface for the user application. In addition, panel diagrams can only be “used”
on the host and can be “used” only from within Rational Rhapsody.
The following illustration shows an animated panel diagram for a hypothetical coffee maker
application. During animation, the developer of the application can test it by doing such things as,
for example:
Turn on the coffee maker application by clicking the power On/Off Switch control.
Use the coffeeContainer and milkContainer Bubble Knob controls to increase/decrease
the amount of coffee and milk that is available.
Order a coffee by clicking the evCoin Push Button control. The following could happen:
– Messages appear on the Matrix Display control, such as Filling Coffee or
Filling Cup.
– The coffeeContainer and milkContainer Level Indicator controls go down
as these items are dispensed.
– The cup Level Indicator control rises as coffee fills a cup, until the Please
Take Your Cup message displays on the Matrix Display control.
– The Take cup LED control turns red.
– The cupCounter Digital Display control keeps a count of each cup of coffee
made.
Indicate that a cup of coffee has been taken by clicking the evTakeCup Push Button
control, which could reset the coffee machine.
1. Open your Rational Rhapsody model with model elements ready for use.
2. Create a panel diagram. Choose Tools > Diagrams > Panel Diagram.
For basic information on diagrams, including how to create, open, and delete them, see
Graphic editors.
3. Create a control element in your panel diagram; click any of the tools on the panel
diagram Diagram Tools. See Panel diagram drawing tools.
4. Bind the control to a model element; right-click a control and select Features. Use the
Element Binding tab on the Control Properties tab. See Bind a control element to a model
element.
5. Make whatever changes you might want for the control; see:
7. Generate and make your model. Run your application and the animation for the panel
diagram. When animation starts, the control on your panel diagram is initiated with its
bound model element value. See Basic code generation concepts.
8. Use your control elements on the animated panel diagram. Note that when animation is
running, the Control Properties window and the Display Options window are unavailable.
9. Terminate animation to terminate the use of the control element and exit animation.
10. Use ReporterPLUS to produce a panel diagram report. For more information, see
ReporterPLUS.
Drawing
Description
Icon
Select Lets you select a control on a panel diagram.
Knob Represents a Bubble Knob control. See Drawing a bubble knob control.
Level Indicator Represents a Level Indicator control. See Drawing a level indicator control.
Matrix Display Represents Matrix Display control that shows a text string. See Drawing a matrix
display control.
Digital Display Represents a Digital Display control that shows numbers. See Drawing a digital
display control.
On/Off Represents an On/Off Switch control. See Drawing an on/off switch control.
Push Button Represents a Push Button control. See Drawing a push button control.
Button Array Represents a Button Array control. See Drawing a button array control.
Text Box Represents an editable Text Box control. See Drawing a text box control.
2. Click the drawing area to create a Bubble Knob control, or click and drag so that you can
create the control to a certain size.
3. To bind the control element to the model element that the control is to regulate or monitor,
see Bind a control element to a model element.
4. Make whatever changes you might want for the control:
To change the settings for the control, see Change the settings for a control element
To change the properties for the control, see Change the properties for a control
element and Properties for a bubble knob control
To change the display name for the control, see Changing the display name for a
control element
2. Click the drawing area to create a Gauge control, or click and drag so that you can create
the control to a certain size.
3. To bind the control element to the model element that the control is to regulate or monitor,
see Bind a control element to a model element.
4. Make whatever changes you might want for the control:
To change the settings for the control, see Change the settings for a control element
To change the properties for the control, see Change the properties for a control
element and Properties for a gauge control
To change the display name for the control, see Changing the display name for a
control element
2. Click the drawing area to create a Meter control, or click and drag so that you can create
the control to a certain size.
3. To bind the control element to the model element that the control is to regulate or monitor,
see Bind a control element to a model element.
4. Make whatever changes you might want for the control:
To change the settings for the control, see Change the settings for a control element
To change the properties for the control, see Change the properties for a control
element and Properties for a meter control
To change the display name for the control, see Changing the display name for a
control element
2. Click the drawing area to create a Level Indicator control, or click and drag so that you can
create the control to a certain size.
3. To bind the control element to the model element that the control is to regulate or monitor,
see Bind a control element to a model element.
To change the settings for the control, see Change the settings for a control element
To change the properties for the control, see Change the properties for a control
element and Properties for a level indicator control
To change the display name for the control, see Changing the display name for a
control element
2. Click the drawing area to create a Matrix Display control, or click and drag so that you can
create the control to a certain size.
3. To bind the control element to the model element that the control is to regulate or monitor,
see Bind a control element to a model element.
To change the settings for the control, see Change the settings for a control element
To change the properties for the control, see Change the properties for a control
element and Properties for a matrix display control
To change the display name for the control, see Changing the display name for a
control element
2. Click the drawing area to create a Digital Display control, or click and drag so that you can
create the control to a certain size.
3. To bind the control element to the model element that the control is to regulate or monitor,
see Bind a control element to a model element.
To change the settings for the control, see Change the settings for a control element
To change the properties for the control, see Change the properties for a control
element and Properties for a digital display control
To change the display name for the control, see Changing the display name for a
control element
3. To bind the control element to the model element that the control is to regulate or monitor,
see Bind a control element to a model element.
4. Make whatever changes you might want for the control:
To change the settings for the control, see Change the settings for a control element
To change the properties for the control, see Change the properties for a control
element and Properties for a LED control
To change the display name for the control, see Changing the display name for a
control element
3. To bind the control element to the model element that the control is to regulate or monitor,
see Bind a control element to a model element.
To change the settings for the control, see Change the settings for a control element
To change the properties for the control, see Change the properties for a control
element and Properties for a on/off switch control
To change the display name for the control, see Changing the display name for a
control element
2. Click the drawing area to create a Push Button control, or click and drag so that you can
create the control to a certain size.
3. To bind the control element to the model element that the control is to regulate or monitor,
see Bind a control element to a model element.
To change the settings for the control, see Change the settings for a control element
To change the display name for the control, see Changing the display name for a
control element
You can bind it to an attribute. In addition, you can set a value for each switch to be set on
the attribute.
Its attribute types are a Number and a String.
By default its control direction In/Out, though you can change it to In or Out.
To draw a Button Array control on a panel diagram:
3. To bind the control element to the model element that the control is to regulate or monitor,
see Bind a control element to a model element.
To change the settings for the control, see Change the settings for a control element
To change the value binding for the control; see Setting the value bindings for a
button array control.
To change the display name for the control, see Changing the display name for a
control element
2. Click the drawing area to create a Text Box control, or click and drag so that you can
create the control to a certain size.
3. To bind the control element to the model element that the control is to regulate or monitor,
see Bind a control element to a model element.
To change the settings for the control, see Change the settings for a control element
To change the display name for the control and/or its data flow direction, see
Changing the display name for a control element.
To change the format settings (for example, line, fill, and font) for a Text Box
control, see Change the format of a single element.
2. Click the drawing area to create a Slider control, or click and drag so that you can create
the control to a certain size.
3. To bind the control element to the model element that the control is to regulate or monitor,
see Bind a control element to a model element.
To change the settings for the control, see Change the settings for a control element
To change the properties for the control, see Change the properties for a control
element and Properties for a slider control
To change the display name for the control, see Changing the display name for a
control element
A binding definition for a control element defines the following binding settings of each control
element.
Element type:
– Control element - input sets data to bound element
– Monitor element - output gets data from bound element
Valid model elements for binding (attribute, event, and state)
Value attribute types that can be set/get by the control element (Number, String, or
Boolean)
A binding definition for a control element is predefined in Rational Rhapsody. It cannot be
changed. For example, the Bubble Knob has the following binding definition:
In the binding operation, you have to set the model element for binding. You can also set the
instance path.
1. Right-click the control and select Features to open the Control Properties window.
If the control has no binding, the Control Binding Browser opens with the project
container as the selected item. Use the browser to navigate to and select the
elements for which you want to bind to the control element, or you can enter the
element path in the Instance Path box.
Note that the browser root is the project and the end nodes are the meta classes
that can be bound for the particular control element. If no relevant end node is
found, the system notifies you that no relevant item was found and the Control
Properties window does not open.
If the control has a bound element, the browser opens with the bound model
element selected.
If no relevant element for binding is found in the model, the Element Binding tab
displays blank with a note to that effect.
For more information about binding, see More about binding a control element.
3. Click OK.
In the case where the element for binding is owned by a modeled root Instance, the object
is displayed by the browser on the Element Binding tab on the Control Properties
window containing all relevant items for binding. You can select the element from the
browser or alternatively type in the element path (stating at modeled root object) in the
Instance Path box.
Binding an item of a dynamic root Instance
In the case where the element for binding is owned by a dynamic root Instance (modeled
class that will be instantiated at run time), the element root class is displayed by the
browser on the Element Binding tab containing all relevant items for binding. You can
select the element from the browser or alternatively type in the element path (stating at
modeled root class) in the Instance Path box.
In both ways, if the dynamic Instance name is different from the default class instance
name, the name should be entered following item selection.
Binding an item with multiplicity on its root object and parts
In the case where bound element owner parts has multiplicity: Selecting the element
through the browser on the Element Binding tab creates the path in the Instance Path
box with “0” multiplicity on the relevant parts. You can then set the multiplicity as
needed. If you enter a path, it is your responsibility to add multiplicity where needed.
The following table summarizes the binding (mapping) characteristics for each panel diagram
control element:
Attribute types
Only attributes that hold predefined primitive (or enumeration) types could be bound. The
supported predefined types are:
Number: int, unsigned int, short, unsigned short, long, double, float,
RhpInteger, RhpPositive, RhpReal
String: char, char*, RhpString, OMString, CString
Boolean: Bool, OMBoolean, RhpBoolean, RiCBoolean
Where possible (for example, for the Bubble Knob control), you can also change their control
direction (to input, output, or both). By default, they are set to InOut. You can use the Control
Direction area of the Settings tab on the Control Properties window to change the control
direction when possible.
1. Right-click a control and select Features to open the Control Properties window.
2. Make your changes on the Settings tab. Note that the settings that are available depend on
the type of control element you have selected.
3. If applicable for a control, select an radio button in the Control Direction area:
Note: The Properties tab displays only when appropriate for the selected control
element. In addition, the tab shows only those settings that are applicable to
that control element.
0=
1=
2=
3=
4=
5=
6=
7=
8=
9= (default)
State To change the state of the control, change the value in the right column.
The default is True.
UserInteractionEnabled To change is user interaction is enable, change the value in the right
column. The default is True.