Essentials of IBM Rational Rhapsody v7.6 for Software Engineers QQ139 ERC 1.0 Student Workbook

Size: px
Start display at page:

Download "Essentials of IBM Rational Rhapsody v7.6 for Software Engineers QQ139 ERC 1.0 Student Workbook"

Transcription

1 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers QQ139 ERC 1.0 Student Workbook

2 IBM Corporation Rational software U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. This information was developed for products and services offered in the U.S.A. IBM may not offer the products, services, or features discussed in this documentation in other countries. Consult your local IBM representative for information on the products and services currently available in your area. Any reference to an IBM product, program, or service is not intended to state or imply that only that IBM product, program, or service may be used. Any functionally equivalent product, program, or service that does not infringe any IBM intellectual property right may be used instead. However, it is the user's responsibility to evaluate and verify the operation of any non-ibm product, program, or service. IBM may have patents or pending patent applications covering subject matter described in this document. The furnishing of this document does not grant you any license to these patents. You can send license inquiries, in writing, to: IBM Director of Licensing IBM Corporation North Castle Drive Armonk, NY U.S.A. For license inquiries regarding double-byte (DBCS) information, contact the IBM Intellectual Property Department in your country or send inquiries, in writing, to: Intellectual Property Licensing Legal and Intellectual Property Law IBM Japan Ltd , Shimotsuruma, Yamato-shi Kanagawa Japan The following paragraph does not apply to the United Kingdom or any other country where such provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express or implied warranties in certain transactions, therefore, this statement may not apply to you. This information could include technical inaccuracies or typographical errors. Changes are periodically made to the information herein; these changes will be incorporated in new editions of the publication. IBM may make improvements and/or changes in the product(s) and/or the program(s) described in this publication at any time without notice. Any references in this information to non-ibm Web sites are provided for convenience only and do not in any manner serve as an endorsement of those Web sites. The materials at those Web sites are not part of the materials for this IBM product and use of those Web sites is at your own risk. Licensees of this program who wish to have information about it for the purpose of enabling: (i) the exchange of information between independently created programs and other programs (including this one) and (ii) the mutual use of the information which has been exchanged, should contact:

3 Intellectual Property Dept. for Rational Software IBM Corporation 5 Technology Park Drive Westford, MA U.S.A. Such information may be available, subject to appropriate terms and conditions, including in some cases, payment of a fee. The licensed program described in this document and all licensed material available for it are provided by IBM under terms of the IBM Customer Agreement, IBM International Program License Agreement or any equivalent agreement between us. Any performance data contained herein was determined in a controlled environment. Therefore, the results obtained in other operating environments may vary significantly. Some measurements may have been made on development-level systems and there is no guarantee that these measurements will be the same on generally available systems. Furthermore, some measurements may have been estimated through extrapolation. Actual results may vary. Users of this document should verify the applicable data for their specific environment. Information concerning non-ibm products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not tested those products and cannot confirm the accuracy of performance, compatibility or any other claims related to non- IBM products. Questions on the capabilities of non-ibm products should be addressed to the suppliers of those products. All statements regarding IBM's future direction or intent are subject to change or withdrawal without notice, and represent goals and objectives only. This information contains examples of data and reports used in daily business operations. To illustrate them as completely as possible, the examples include the names of individuals, companies, brands, and products. All of these names are fictitious and any similarity to the names and addresses used by an actual business enterprise is entirely coincidental. If you are viewing this information in softcopy, the photographs and color illustrations may not appear. Trademarks and service marks IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at Copyright and trademark information at Adobe, the Adobe logo, PostScript, and the PostScript logo are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States, and/or other countries. IT Infrastructure Library is a registered trademark of the Central Computer and Telecommunications Agency which is now part of the Office of Government Commerce Intel, Intel logo, Intel Inside, Intel Inside logo, Intel Centrino, Intel Centrino logo, Celeron, Intel Xeon, Intel SpeedStep, Itanium, and Pentium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. Intel trademark information Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both.

4 Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries, or both. Microsoft trademark guidelines ITIL is a registered trademark, and a registered community trademark of the Office of Government Commerce, and is registered in the U.S. Patent and Trademark Office UNIX is a registered trademark of The Open Group in the United States and other countries. Cell Broadband Engine is a trademark of Sony Computer Entertainment, Inc. in the United States, other countries, or both and is used under license therefrom. Java and all Java-based trademarks and logos are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. Other company, product, or service names may be trademarks or service marks of others.

5 Lab 1: Hello World Objectives After completing this lab, you will be able to: Create a new Rational Rhapsody project Do basic modeling using classes, attributes, and operations Given No lab artifacts are required Scenario This lab gets you started using the Rhapsody environment to do basic modeling. You test the system setup, which might be either a VMware image or a locally installed setup. Copyright IBM Corp Lab 1-1

6 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 1: Creating a project In this task, you start Rational Rhapsody and begin a new project. You add a class, constructor, and implementation to an Object model diagram. 1. Start Rational Rhapsody: Select Start > All Programs > IBM > Rational > Rhapsody. Double-click the IBM Rational Rhapsody 2. Close the Welcome to Rhapsody screen. icon on the desktop. 3. Start a new Rhapsody project. a. Select File > New. b. Click the new document icon 4. Name the project: Hello in the C:\Work folder. Keep Default as the project type. Click OK. Lab 1-2 Copyright IBM Corp. 2012

7 Lab 1: Hello World 5. When you are prompted that the project does not exist in C:work and asked if you want to create it, click Yes. 6. The browser shows you everything that is in the model. Rational Rhapsody creates an object model diagram (OMD). The browser is on the left, the model diagram in the middle, and the diagram tools are on the right. 7. In the object model diagram, click the class icon to draw a class named Display. Copyright IBM Corp Lab 1-3

8 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 8. Expand the browser to confirm that the new class appears. 9. Click the Show/Hide Drawing toolbar to clear the Diagram tools from the right side. Click it again to reopen the diagram tools. 10. Right-click the Display class, and select Add New > Constructor. You do not need any constructor arguments. Click OK. You can also add constructors by using the Features > Operations tab. Click New and select Constructor. 11. Right-click the Display class and select Display Options. Set the options to display all attributes and all operations. Lab 1-4 Copyright IBM Corp. 2012

9 Lab 1: Hello World Copyright IBM Corp Lab 1-5

10 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 12. Confirm that the constructor is shown in the browser as follows: 13. Select the Display constructor in the browser and double-click to open the features. 14. Select the Implementation tab and enter: std::cout << "Hello World" << std::endl; Lab 1-6 Copyright IBM Corp. 2012

11 Lab 1: Hello World 15. Click OK. Note: If you are using Visual C++ 6.0, you do not need the std namespace in the implementation. Task 2: Add an include and more to the Display class In this task, you change a Rational Rhapsody property. Since you have used cout, you must add an include of the iostream header to the display class. 1. In the browser, double-click the Display class to open the features. 2. Click the Properties tab and select the Common view.. For the ImpIncludes property, enter <iostream>. ImpIncludes is an abbreviation for Implementation Includes. Click OK. 3. Task 3: Create a component Before you can generate code, you must first create a component. Copyright IBM Corp Lab 1-7

12 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 1. Expand the components in the browser and rename the existing DefaultComponent component to Test. Also name the Directory Test. Click OK. 2. Expand Configurations and rename the DefaultConfig as Release. 3. Open Release. Select the Initialization tab, expand the Default package, and select the Display class. Click OK. The main test file then creates an initial instance of the Display class. Lab 1-8 Copyright IBM Corp. 2012

13 Lab 1: Hello World 4. Select the Settings tab for the Release configuration. Confirm that the environment setting is set for Cygwin. Copyright IBM Corp Lab 1-9

14 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 4: Generate code for the model In this task, you execute the model. 1. Expand the Object Model Diagrams in the browser. Right-click Object Model Diagram Model1 to open the Features dialog box. 2. Rename the diagram from Model1 to Overview. You are ready to generate code. 3. Save the model. 4. Select Generate/Make/Run., and click Yes to answer the question. Lab 1-10 Copyright IBM Corp. 2012

15 Lab 1: Hello World 5. Verify that you see the Hello World executable in black as in the previous screen capture. 6. If there are errors during the build, double-click the relevant line to find out where the error occurred. 7. Before continuing, stop the executable in one of these ways: Close the console window. Click Stop Make/Execution Press Ctrl+Break.. Task 5: Examine and modify the code In this task, you examine the generated files. You make a modification to the code. 1. Examine the generated files located in the C:\work\Hello\Test\Release folder. Next, you can edit the generated files in Rational Rhapsody. Copyright IBM Corp Lab 1-11

16 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 2. Select the Display class in the browser, right-click, and select Edit Code. Both the implementation (.cpp file) and the specification (.h file) are shown in the tabbed windows. 3. In the Display.cpp file, change the implementation to print Constructed instead of Hello World. 4. Examine the implementation for the display constructor in Rational Rhapsody. Confirm that Hello World is changed to Constructed. 5. If you are prompted with the question, Do you want to roundtrip the code?, answer Yes. But beware, not everything can be roundtripped. 6. Double-click the Main and Makefile links and examine the files. Lab 1-12 Copyright IBM Corp. 2012

17 Lab 1: Hello World 7. Examine the project files in the C:\Work\Hello folder. Task 6: Customizing Rational Rhapsody In this task you create a new helper called Explore. Rational Rhapsody uses the new helper to run the Microsoft Explorer command to locate the C:work/Hello directory. 1. Select Tools > Customize>Helpers. Copyright IBM Corp Lab 1-13

18 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 2. Click the icon to enter a new entry Explore in the Tools menu. 3. Set the Command to explorer. Click OK. 4. Set Arguments to. Click OK. Lab 1-14 Copyright IBM Corp. 2012

19 Lab 1: Hello World 5. Select Tools > Explore. Verify that you see the C:\Work\Hello files. Copyright IBM Corp Lab 1-15

20 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Lab 1-16 Copyright IBM Corp. 2012

21 Lab 2: Countdown Objectives After completing this lab, you will be able to: Create a Rational Rhapsody project Use the Active Code view Create and build a statechart Animate the model Add a sequence diagram Given The Hello World model that you created in Lab 1. Scenario You create a new folder in Rational Rhapsody named CountDown. Copyright IBM Corp Lab 2-1

22 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 1: Copying a project The Hello project that you created in Lab 1 is open in Rational Rhapsody. 1. Select File > Save as. 2. Click to select the work folder, and click to create a new folder, and rename it CountDown. 3. Select the new CountDown folder. 4. Save the project as CountDown.rpy. 5. The new CountDown project opens in Rational Rhapsody with the previous workspace preserved. 6. Save and close Rational Rhapsody. Note that each time there is an auto-save, Rhapsody saves only what has changed since the last auto-save. Task 2: Loading a project 1. Choose one of the following ways to open a project: Method 1: a. Start Rational Rhapsody and select File > Open. b. Double-click the CountDown.rpy file. Method 2: a. Start Rational Rhapsody and drag the CountDown.rpy file into Rational Rhapsody. b. Click Open Project in the Welcome screen. 2. To add an attribute, double-click the Display class to bring up the features and select the Attributes tab. 3. Click New to add a count attribute of the int type. 4. Set the initial value to 0, and click Save. 5. Right-click the Display class and select Edit code. If you receive an error message, select the model and click Generate/Make/Run. Lab 2-2 Copyright IBM Corp. 2012

23 Lab 2 CountDown Initial value Mutator Protected attribute Accessor Note: Changing the visibility in the Attribute features dialog box changes the mutator and accessor visibility (but not the data member visibility). Copyright IBM Corp Lab 2-3

24 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 6. Right-click the Display class to see the features. Select the Operations tab > Primitive Operation. 7. Add a new primitive operation called print. Set the visibility as Public and the Return Type as void. v 8. Double-click Print to open the features for the print operation, and select the Arguments tab. 9. Add an n argument of the int type. Lab 2-4 Copyright IBM Corp. 2012

25 Lab 2 CountDown 10. Select the Implementation tab for the print operation and add: std::cout << Count = << n << std::endl; 11. Right-click the Operation folder in the browser and click Add new > operation with an argument s of type char* and with the implementation std::cout << s << std::endl; Copyright IBM Corp Lab 2-5

26 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 12. Name the new operation print. 13. Set the argument type before setting the name, to avoid a conflict where the two print operations have identical signatures. 14. Add another operation called isdone that returns a bool and has the following implementation: return (0==count); Lab 2-6 Copyright IBM Corp. 2012

27 Lab 2 CountDown Note: By typing 0==count instead of count==0, you enable the compiler to detect a common error where= is typed instead of ==. Task 3: Viewing code in the Active Code view The active code view facilitates your viewing and editing the code that is generated for the model. Active Code view is context sensitive and is automatically updated as the model changes. The window also changes dynamically to show the generated code for the highlighted model element. 1. Click Code > Dynamic Model Code Associativity > Bidirectional. 2. Select View > Active Code view for the model. View the code for the display.cpp file. 3. Float and hide the active code view by clicking the button. 4. Turn off Active Code view. 5. Change the implementation for the Display operation from: std::cout << "Constructed << std::endl; to: print ( Constructed ); 6. Save the change. 7. Click Code > Generate > Release. Run. Check that the modification to Contructed has been automatically roundtripped. Task 4: Adding a statechart Now you want to get the Display class to count down from 10 to 0 in intervals of 200ms, so you must assign some behavior to the class. You can do this by adding a statechart. 1. Right-click the Display class and select Add New > Statechart. Draw the statechart shown below following the steps. You can enter information for a transition in two ways: Copyright IBM Corp Lab 2-7

28 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook In text format example: [isdone()]/print( Done ); By using the features of the transition (double-click or right-click the transition). Action Default transition Trigger State Guard Transition a. Using the diagram tools, draw a state named Active. b. Draw a default transition to the active state. c. On the default transition, immediately type: /count=10;print( Started ); d. Draw a condition connector below the active state. e. Draw a transition from the active state to the condition connector and immediately type: tm(200)/print(count); f. Type a transition from the condition connector to the active state and immediately type [else]/--count; g. Draw a termination connector below the condition connector. h. Draw a transition from the condition connector to the termination connector and immediately type: [isdone()]/print( Done ); 2. Click Code > Generate > Release, and right-click the model and select Make. When that operation finishes, right-click again and select Run. 3. Troubleshoot any errors that you get. 4. Examine the output. You should see: Lab 2-8 Copyright IBM Corp. 2012

29 Lab 2 CountDown Close the running window before doing another Generate/Make/Run. 5. Confirm that the browser now includes the new statechart. Note that the Display class is reactive: it reacts to the events or timeouts that it receives. 6. Click View > Active Code View and examine the generated code for the Display class (Display.h). Copyright IBM Corp Lab 2-9

30 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook The Display class inherits from OMReactive, which is one of the framework base classes. The OMReactive class simply waits for timeouts or events. When it receives a timeout or an event, it calls the rootstate_processevent() operation. Task 5: Changing the statechart implementation In this task you change the statechart implementation. 1. Select the features for the Release configuration. Lab 2-10 Copyright IBM Corp. 2012

31 Lab 2 CountDown 2. Click the Settings tab and set the statechart implementation from Flat to Reusable. 3. Save the model. Generate code by selecting Code > Generate > Release. 4. Examine the code. Reusable is based on the state design pattern where each state is an object. Reusable results in faster execution and, if many statecharts are inherited, can result in smaller code. Flat uses a switch statement. Flat results in less code that is easier to read, but is slower. You next validate the model by doing design-level debugging, known as Animation. Task 6: Line shapes in the diagram optional In this extended optional exercise you can experiment with the line shapes of transitions. 1. Select a transition, right-click and select Line Shape > Rectilinear. 2. Repeat the previous step for the other transitions. 3. Save the model. Task 7: Copying the configuration The Release configuration you developed is open in Rational Rhapsody. 1. Select the Release configuration. 2. Press Ctrl and drag the Release configuration to the Configurations folder. Copyright IBM Corp Lab 2-11

32 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 3. Rename the copy to Debug. 4. Click Features > Settings and set the instrumentation mode to Animation. Task 8: Animating the model 1. Verify that the active configuration is Debug. Set the active configuration in one of these ways: Method 1: Right-click the configuration and select Set as Active Configuration. Method 2: Select the configuration by using the pull-down box. 2. Save the model. 3. Click the Generate/Make/Run button. The Run action displays the Animation toolbar. Lab 2-12 Copyright IBM Corp. 2012

33 Lab 2 CountDown The Animation toolbar automatically appears when an executable model is run and instrumentation is set to Animation. To display or hide the toolbar during the animation session, select View > Toolbars > Animation. For detailed button information, select Help > Help Topics and search on animation toolbar. For example, the grayed out (disabled) Thread button indicates a single-threaded application. 4. Click Go Step. Note that the Display() constructor appears in the Call Stack. 5. Continue to click Go Step until you see the Executable is Idle message in the animation window. Task 9: Creating the Class instance The browser contains an instance of the Display class. 1. With the animation still running, confirm that the browser contains an instance of the Display class. 2. Right-click the instance and select Features. 3. Note that the count attribute has been initialized to 10. Click OK. Copyright IBM Corp Lab 2-13

34 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 4. Right-click the Display instance and select Open Instance Statechart. The highlighted state indicates the current state of the model. If you do not see a highlighted state, you might be looking at the statechart of the class (the design) rather than the statechart of the instance (the runtime). The default transition has also been triggered. You can see Started in the display. 5. Click Go Idle to advance to the next timeout. The executed transition chain in the statechart is highlighted. The value for count is shown in the display. Lab 2-14 Copyright IBM Corp. 2012

35 Lab 2 CountDown Condition checked for is done. Not done so value of count is decremented. Confirm that the count goes to Click Go and watch the animation until the instance is destroyed. 7. Exit the animation.. Task 10: Adding a destructor 1. Add a destructor to the Display class. Right-click the class and select Add New>Destructor. 2. Add the implementation print ( Destroyed ); Make sure you make the change in the implementation and not in the description field. 3. Save, and click Generate/Make/Run. Task 11: Creating sequence diagrams 1. In the Rhapsody browser, create a new sequence diagram called execution. Right-click the CountDown project, and click Add New > Diagrams > Sequence Diagram. This sequence diagram captures what happens in execution. Operation mode is discussed later, but for this example it does not matter if you select analysis or design. 2. Add a system border to the sequence diagram. Copyright IBM Corp Lab 2-15

36 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 3. Drag the Display class from the browser to the sequence diagram. For the purpose of this training, you only need the system border and the Display instance line. There is no need to add any operations. 4. Start the animation and click Go. If a sequence diagram is open, Rational Rhapsody creates a new animated sequence diagram based on the execution. Note that the animated sequence diagram captures operations, timeouts, and states. To display the return value on animated sequence diagrams, use the OM_Return macro. 5. In the implementation of the operation isdone(), replace return with OM_RETURN. Lab 2-16 Copyright IBM Corp. 2012

37 Lab 2 CountDown Task 12: Adding an extra state (optional) 1. Add an extra state to the statechart and name it pausing with a tm(300). 2. Click Generate/Make/Run. 3. Click Go Step. Note that the Display() constructor appears in the call stack. 4. Continue to click Go Step until the message Executable is Idle message appears in the animation window. 5. Click Go and watch the animated statechart change states to Pausing. Copyright IBM Corp Lab 2-17

38 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Lab 2-18 Copyright IBM Corp. 2012

39 Lab 3: Properties Objectives After completing this lab, you will be able to: Change properties in the Countdown project and see the differences applied to the model. Given There are many different properties and these are very powerful in Rhapsody. There are many ways to change your model by modifying the properties. You modify the Debug configuration in this lab. Scenario You edit the properties in Rational Rhapsody Debug. Copyright IBM Corp Lab 3-1

40 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 1: Modifying properties You can customize the tool and the generated code by using properties. You can set properties permanently by modifying the site.prp file in the Rhapsody/7.6/Share/Properties directory. The factory.prp and factoryc++.prp files contain all the Rhapsody properties. It is best to modify the site.prp or sitec++.prp files rather than the factory.prp and factoryc++.prp files. You can apply stereotypes to model elements, and assign properties to model elements and stereotypes. Properties that are assigned to a stereotype are applied to the element that is stereotyped, and therefore those stereotype properties override the element properties. Rhapsody reads the properties files in descending order starting from the factoryc++.prp file. For this course you use the most common properties, which you can see by using the Common view. Lab 3-2 Copyright IBM Corp. 2012

41 Lab 3 Properties 1. Open the Features for the CountDown project and click the Properties tab. Set the General:Graphics:MaintainWindowContent property by clicking the property box. The description for MaintainWindowContent is shown. By setting the MaintainWindowContent property, if you change the size of a window you maintain the same size for the window content. 2. From the View list, select Overridden. Copyright IBM Corp Lab 3-3

42 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook The previous image shows only the properties that you modified. Accessors and mutators are automatically generated for each attribute and relation of the class. You can set properties to stop the generation of accessors and mutators if the latter are not required for attributes. 3. Set the AccessorGenerate and the MutatorGenerate property so that the attributes in the project do not have an accessor or a mutator. 4. For the count attribute, you want an accessor. Select the count attribute in the browser, select the Features > Properties tab, and override the AccessorGenerate property. 5. From the View list, select Locally Overridden to show that only the AccessorGenerate property is set locally. 6. Generate the code. Lab 3-4 Copyright IBM Corp. 2012

43 Lab 3 Properties 7. Select the count attribute, right-click and select Edit attribute. 8. Examine the Display.cpp file and confirm you see the following line: int Display::getCount() const { return count; } 9. Create a customized filter: a. At the project level, right-click Features > Properties and select Filter. b. In the Filter text field, enter namespace. c. Select Match category name. Click Filter. Copyright IBM Corp Lab 3-5

44 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 2: The image above shows only the properties with the word namespace in them. Optional: Experimenting with more properties You can test what happens when you activate other project properties. 1. Right-click the project at the top level, and select Features > Properties. Select the GeneratedCodeInBrowser check box. 2. You must regenerate the code after setting this property. Select Code>Re Generate. Confirm that the generated code appears in the Default > Classes > Display > Operations folder in the browser. Lab 3-6 Copyright IBM Corp. 2012

45 Lab 3 Properties Task 3: Optional: Formatting diagrams You can format line colors, fill colors, and fonts by right-clicking an element and selecting Format. 1. On the Statechart diagram in the Countdown project, right-click the Active state and select Format. Change the color of the Active state to a color of your choice. 2. Right-click the project at the project level and select Format. Change the fill color of the statebox metaclass to your chosen color. The color of all the states in the project are changed. Copyright IBM Corp Lab 3-7

46 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Lab 3-8 Copyright IBM Corp. 2012

47 Lab 4: The dishwasher project Objectives After completing this lab, you will be able to: Start a new project and add a class. Add attributes and operations to a class. Add return types and implementations. Build a statechart. Run the executable model and test the states. Create and use a flowchart. Given You build the dishwasher model and make changes to it. You execute the model to test it. Scenario You are starting a new project called Dishwasher. Copyright IBM Corp Lab 4-1

48 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 1: Starting the project 1. Create a new project named Dishwasher in its own folder in C:\work. 2. Click the Class icon on the drawing toolbar to the right of the diagram, draw a single class named Dishwasher. Task 2: Adding attributes and operations to the class You now add attributes and operations to the Dishwasher class. You then add a new type. 1. Right click the Dishwasher class in the browser, and select Features > Attributes. 2. Add the following attributes and give them an Initial Value of 0: cycles, drytime, rinsetime, washtime. 3. Add the following operations in the Features > Operations tab and give them all a Return Type of bool except setup which returns void: isdried, isinneedofservice, isrinsed, iswashed, setup. Lab 4-2 Copyright IBM Corp. 2012

49 Lab 4 Dishwasher Task 3: Add implementations to the operations 1. For the isdried operation, add the following implementation: return (0==dryTime); 2. For the isinneedofservice operation, add the following implementation: return (cycles>max_cycles); 3. For the isrinsed operation, add the following implementation: return (0==rinseTime); 4. For the iswashed operation, add the following implementation: return (0==washTime); 5. For the setup operation, add the following implementation: rinsetime=4; washtime=5; drytime=3; Copyright IBM Corp Lab 4-3

50 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 6. Select the Default package, right-click and select Add New > Type. 7. Enter MAX_CYCLES as the type name, ensure that Kind is set to Language, and add the following declaration: const int %s=3; Note: %s is a shortcut for the name of the type. Lab 4-4 Copyright IBM Corp. 2012

51 Lab 4 Dishwasher : 8. Double-click the DefaultComponent and rename Test. 9. Double-click the DefaultConfig and rename it Debug. 10. Right-click the Debug configuration and open the Features. Click the Initialization tab and select the Dishwasher check box. Copyright IBM Corp Lab 4-5

52 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 11. For the Debug configuration, select the Features > Settings tab and set the instrumentation mode to Animation. Set the Environment to Cygwin if it is not set to Cygwin already. Task 4: Build the model and create an initial instance of the class 1. Save the model. Click Generate > Make > Run. If the model does not run, examine the Build message view to determine what the build errors are and correct them. Lab 4-6 Copyright IBM Corp. 2012

53 Lab 4 Dishwasher 2. When the model is running and the simulation box appears as shown in the following image, click Go or press F4 in Rhapsody. c 3. Confirm that the initial instance of the Dishwasher class is created in the model by examining it in the browser. Copyright IBM Corp Lab 4-7

54 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 4. Click the Stop icon to stop the animation. Task 5: Create a statechart In this task you create a statechart and add concurrent states, nested states, connectors, and transitions to the statechart. 1. Add a Statechart to the Dishwasher class by right-clicking the Dishwasher class in the browser and selecting Add new > Diagrams > Statechart. 2. Draw a state as large as possible called active. Note: When drawing a complex diagram such as a statechart, it is a good idea to maximize the statechart window and to close all other windows. 3. Click the And line icon on the drawing toolbar to create concurrent states. To draw the And line: Click and drag the line. Click to start the line and then double-click to end the line. 4. Draw the first And line horizontally across the active state. Draw the second And line vertically down to the bottom of the active state starting at the horizontal And line. Lab 4-8 Copyright IBM Corp. 2012

55 Lab 4 Dishwasher 5. Right-click each of the new concurrent states and select Display options. Click Name. Click OK. Confirm that the names state_1, state_2, and state_3 appear. 6. Right-click each concurrent state to get the Features and change the names to running, mode, and service. Now the states are running, mode, and service 7. Select the stamp mode, click the State icon, and add the following states: a. To the running state, add off and open. b. To the running state, add on, and within on, add washing, rinsing, and drying. c. To the mode state, add quick and intensive. d. To the service state, add normal and faulty. Note: To change the size of an outer state without changing the inner state, press Alt when changing the size. Copyright IBM Corp Lab 4-9

56 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 8. Add a history connector to the on state. 9. Add two diagram connectors, both named done, to the running state. Task 6: Add transitions and actions to the statechart In this task you add transitions and events to the statechart. When you must type a name of an existing operation or attribute, you can press Ctrl+ Space to facilitate entering names. 1. Add a default transition going to the off state. 2. Add a default transition going to the History connector. 3. Add a default transition going to the normal state. 4. Add a default transition going to the quick state. 5. Add a transition from the done diagram connector to the off state. 6. Add a transition from the off state to the washing state and type evstart/setup(); 7. Add a transition from the on state to the open state and type evopen. 8. Add a transition from the open state to the history connector and type evclose. 9. Add a transition from the history connector to the washing state. 10. Add a transition from the washing state to itself and type tm(1000)/--washtime; 11. Add a transition from the washing state to the rinsing state and type [iswashed()] 12. Add a transition from the rinsing state to itself and type tm(1000)/-- rinsetime; 13. Add a transition from the rinsing state to the drying state and type [isrinsed()] 14. Add a transition from the drying state to itself and type tm(1000)/--drytime; Lab 4-10 Copyright IBM Corp. 2012

57 Lab 4 Dishwasher 15. Add a transition from the drying state to done and type [isdried()]/cycles++; 16. Draw a transition from the normal state to the faulty state and type [isinneedofservice()] 17. Draw a transition from the faulty state to the normal state and type evservice. 18. Draw a transition from the normal state to itself and type evservice. 19. Draw a transition from the quick state to the intensive state and type evmode. 20. Draw a transition from the intensive state to the quick state and type evmode. 21. Click the normal state and open the Features. In the Action on entry field enter cycles=0; Copyright IBM Corp Lab 4-11

58 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 22. Confirm that the action is set when you see that the symbol is shown on the normal state. 23. Save the model. Task 7: Build and animate the model 1. Select Code > Generate. Lab 4-12 Copyright IBM Corp. 2012

59 Lab 4 Dishwasher 2. Select Code > Build. Confirm that there are no errors in your build. If not, troubleshoot any errors. 3. Click Run executable. 4. Confirm that the simulation box appears and click Go Idle to create a Dishwasher instance. 5. Select Tools > Animated Statechart to open the animated statechart. Copyright IBM Corp Lab 4-13

60 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 6. Confirm that there are three concurrent animated states: The Dishwasher is in an idle state waiting for some events. 7. Generate the evstart event: Right-click anywhere in the animated state chart and select Generate Event. Lab 4-14 Copyright IBM Corp. 2012

61 Lab 4 Dishwasher Click the Command prompt icon. Click the Event Generator icon. The evstart event should appear in the event queue. Click Generate. 8. Click Go and watch the animation. Does your Dishwasher work as expected and complete the washing, rinsing, and drying as shown in the following image? 9. If you inject the evopen event when the Dishwasher is on, what happens? Does it go through the cycles? Now inject the evclose event. Does the Dishwasher remember what state it was in before it was opened? Copyright IBM Corp Lab 4-15

62 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 10. Test the Dishwasher by running it four times to see if it goes into the faulty state after four cycles. Note: Do you recall creating the MAX_CYCLES type with a declaration of const int %s=3; 11. Inject the evservice event to the animated statechart to get it to transition out of the faulty state. a. Inject the evservice event again to get it into the normal state. 12. Start the Dishwasher again by injecting evstart. Task 8: Extended exercise 1 In this exercise, you use the IS_IN macro and a guard to prevent the Dishwasher from being started if it is faulty. 1. On the Dishwasher statechart, on the transition from off to washing, type directly on the diagram to change evstart/setup(); to evstart[is_in(normal)]/setup(); 2. Test the animated startechart by running it through the full cycle four times to get it into the faulty state. 3. Inject the evstart event to the animated statechart. Does the Dishwasher start? Task 9: Extended exercise 2 In this exercise, you modify the setup operation to have conditional behavior based on the mode. You then use Rhapsody to create a flowchart that can visualize this behavior. A flow chart is a specialization of the UML activity diagram. 1. Open the features window for the setup() operation of the Dishwasher class. Change the implementation for the setup() operation to set up different times for rinsing, washing, and drying based on the selected mode in the state machine: if (IS_IN(quick)) { rinsetime=1; washtime=2; Lab 4-16 Copyright IBM Corp. 2012

63 Lab 4 Dishwasher drytime=1; } else { rinsetime=4; washtime=5; drytime=3; } 2. Visualize this logic in a flowchart. Right-click setup() and select Populate Flowchart. Copyright IBM Corp Lab 4-17

64 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 3. If the following dialog box is shown, click OK, to confirm that you want Rhapsody to create the graphic representation automatically. 4. Rhapsody automatically draws a diagrammatic representation of the code. In this instance this is a visualization of the code, and the property CPP_CG::Operation::ImplementFlowchart is automatically deselected on the operation. You can also generate code from flowcharts. This is not covered in the training, because developers often want to write the implementation code by hand. Visualization of logic in operations is often useful for generating documents of the design. 5. Generate, make, and run the model. Click Go. View the animated statechart. Is it in the quick state? 6. Inject the evstart event into the animated statechart. Check the speed that it takes the dishwasher to go through the wash, rinse, and dry cycles. Did it take approximately four seconds to complete? Lab 4-18 Copyright IBM Corp. 2012

65 Lab 4 Dishwasher 7. Inject the evmode event into the statechart to get it into the intensive state. Now inject the evstart event again. Was there a change to the speed the dishwasher completes the cycles? 8. Save the model. Copyright IBM Corp Lab 4-19

66 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Lab 4-20 Copyright IBM Corp. 2012

67 Lab 5: Panel diagram Objectives After completing this lab, you will be able to: Add breakpoints to an animated model. Create a panel diagram. Add buttons, indicators, and a digital display to the panel diagram. Run the panel diagram. Develop and test scripts. Create an animated sequence diagram for the Dishwasher model. Modify the Dishwasher model by replacing a guard with an event. Add a new evfault event to the Dishwasher model. Given You continue to build on the Dishwasher model you created in the previous lab. Scenario You use additional features of Rhapsody to improve your model. Copyright IBM Corp Lab 5-1

68 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 1: Add a breakpoint You can set breakpoints for various reasons, In the tool there is actually a Reason filed for defining the breakpoint. For example, you can check a value of a variable at a particular state and do some analysis, or you can stop and examine an animated sequence diagram when you start your animated statechart. Setting a breakpoint in a model is similar to setting a breakpoint in a source level debugger. In this exercise you add a breakpoint at the open state on the animated statechart. 1. Right-click the open state on the animated statechart and select Add Breakpoint. Leave the reason as the State Entered. 2. Alternatively, you can add or remove a breakpoint by clicking the Breakpoint icon on the animation toolbar. Test your breakpoint by animating the model. Inject the evstart event so it starts washing. Inject the evopen event when it starts to get it into the open state. The event stops at the open state at the breakpoint until you click Go. You also see the following message in the animation box when the animation hits a breakpoint: Executable reached breakpoint. 3. To start the animation after it hits the breakpoint click Go. 4. Remove the breakpoint by clicking the Breakpoint icon. Delete the breakpoint when you see the following by highlighting the breakpoint and clicking Delete.: Lab 5-2 Copyright IBM Corp. 2012

69 Lab 5 Panel diagrams 5. Test the model again through animation to confirm that the breakpoint is removed. When you get the animation to stop at the open state by injecting the evopen event, it starts again when you inject the evclose event, Task 2: Create a simulated time model In the Dishwasher model, timeouts are set on several states for 1000 ms. The system tick is a clock that runs in real time on the computer. It is used for all the timeouts. In the simulated time model, the timeouts are executed in the appropriate order; however, the timeout changes to 0 so that the model execution time is accelerated. An advanced feature of the simulated time model is that you can control the system tick, or the real time clock to advance it, stop it, or roll it back. 1. Make a copy of the Debug configuration: Use cut and paste: Click the Debug Config, press the Ctrl key while dragging the configuration to the Configuration compartment. You will see a copy of Debug. 2. Rename the copy of Debug to Sim. 3. Double-click the Sim configuration to get the Features. Click the Settings tab and for the Time Model click Simulated. Copyright IBM Corp Lab 5-3

70 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 3: Command prompt You can generate events and breakpoints by using the command prompt. Using the command window to call scripts is useful. GEN is a macro that creates the event before sending it to the object. GEN(evStart) send(new evstart, ). 1. In the animated statechart, inject the evstart event to start the Dishwasher through the wash, rinse, and dry cycles through the command window by clicking the Command prompt icon on the animation toolbar. 2. Type Dishwasher->GEN(evStart) Lab 5-4 Copyright IBM Corp. 2012

71 Lab 5 Panel diagrams 3. Confirm that the states change quickly as discussed in the simulated time model task by observing the animated statechart when the event is injected. Task 4: Panel diagrams Panel diagrams are used for simulating and prototyping a panel. Use panel diagrams to imitate hardware devices, to activate and monitor a user application, or to test applications by triggering events and changing attribute values. You can use panel diagrams only with animation configurations. 1. To add a new panel diagram, select the Dishwasher project in the browser. Right-click and select Add New > Diagrams > Panel diagram. 2. Name the new panel diagram Dishwasher Panel. Task 5: Add buttons, level indicators, and a digital display to the panel Use the diagram tools to add buttons and indicators to the panel diagram. Note that you will see <<NO BINDING>>. Disregard and leave these in the diagram. These will not appear in the next task when you do the bindings. 1. Click the LED icon on the diagram tools, and add eight LEDs to the panel diagram numbering them 0-7. (This should be automatic.) 2. Add three level indicators to the diagram. 3. Add five push buttons to the diagram (0-4). 4. Add one digital display button. Copyright IBM Corp Lab 5-5

72 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 6: Bind the buttons to states, attributes, and events 1. Double-click the LEDs to see the Features. In the Features, expand the Dishwasher project, browse to locate the Instance path, and select it. 2. Bind the LED buttons to the states as follows: led_0 to the on state led_1 to the washing state led_2 to the rinsing state led_3 to the drying state led_4 to the open state led_5 to the quick state led_6 to the intensive state led_7 to the service state Lab 5-6 Copyright IBM Corp. 2012

73 Lab 5 Panel diagrams 3. Right-click the elements, select Display Options, and select Bound Element. The name shown is the same as the state the button is bound to. The only exception is to name the led_4 button to door open instead of open. 4. Bind the digital display to the cycles attribute. Copyright IBM Corp Lab 5-7

74 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Lab 5-8 Copyright IBM Corp. 2012

75 Lab 5 Panel diagrams 5. Bind the level indicators to the following attributes: levelindicator_0 to washtime, levelindicator_1 to rinsetime, levelindicator_2 to drytime. 6. Right-click the level indicators, select Display Options, and click None. 7. For each level indicator, use Features > Settings to set the Maximum Value to 5. Click OK. Copyright IBM Corp Lab 5-9

76 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 8. Bind the five push buttons that you added earlier to events as follows: push button_0 to evstart, push button 1 to evopen, push button 2 to evclose, push button 3 to evmode, and push button 4 to evservice. 9. Use Features > Settings to set the captions as follows: Start, Open, Close, Mode, Service. Set the Display options to None. Lab 5-10 Copyright IBM Corp. 2012

77 Lab 5 Panel diagrams 10. Draw a free shape rectangle box around the panel diagram. 11. Right-click the box and select Send to Back. 12. Right-click the box and select Format to change the Fill color to a color of your choice. Copyright IBM Corp Lab 5-11

78 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 13. Click the Text icon on the diagram tools and add the text Rational Rhapsody Dishwasher Panel as a title, with the font style and size that you want. Task 7: Run the panel 1. Run the panel by using the Debug configuration. Click Go. 2. Click Start to start the cycles. 3. Confirm that the cycles increment each time the washing, rinsing, and drying completes. Run the cycle 4 times. Lab 5-12 Copyright IBM Corp. 2012

79 Lab 5 Panel diagrams 4. Confirm that the level indicators go down as washing, rinsing, and drying completes. 5. Confirm that you have an automated statechart running at the same time as the panel diagram. Confirm that the states change on the automated statechart. 6. Experiment with the panel diagram by pressing the buttons on the panel diagram and seeing what happens. At the same time, see what happens on the automated statechart, change the mode, and note the change in elapsed times to progress through the cycles. 7. Save the model. Task 8: Optional: Create a script Another way to test the Dishwasher is with scripts. 1. Select the Test component, right-click and select Add New > File. 2. Name the file TestScript.cfg. 3. Use the Features to Set the Path to..\.. 4. For the File Type, select Other. Copyright IBM Corp Lab 5-13

80 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 5. Click the Elements tab. 6. Add a New Text Element. 7. In the Name field, enter Script Contents. Click OK. Lab 5-14 Copyright IBM Corp. 2012

81 Lab 5 Panel diagrams 8. Click in the Elements tab to start the text editor. 9. Enter the text of the script by cutting and pasting it from the CheatSheet_All.txt. file. Do not leave any blank lines or leading spaces. There is no roundtripping of this file. 10. This is the text of the script: // Script to test the Dishwasher output TestScript.log trace #all all timestamp // First get the Dishwasher to a known state go idle Dishwasher->GEN(evService) break Dishwasher stateentered off break Dishwasher stateentered faulty Dishwasher->GEN(evStart) go Dishwasher->GEN(evStart) go Dishwasher->GEN(evStart) go Dishwasher->GEN(evStart) go // Should now be faulty Copyright IBM Corp Lab 5-15

82 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook go // remove all break points break Dishwasher -stateentered off break Dishwasher -stateentered faulty 11. Save / Generate / Make / Run. 12. Click the Command prompt to run the script. 13. Examine the panel diagram to confirm that it runs through the dishwashing cycle when the script runs. 14. After the script has run and terminated, click Stop to stop the animation. In the Dishwasher project, the log file is created. You can also view the log output in Rhapsody. Lab 5-16 Copyright IBM Corp. 2012

83 Lab 5 Panel diagrams 15. Add a new file element in the model to point to the actual TestScript.log file by selecting the Files category under the Test component and right-clicking Add new > File. 16. Name the file TestScript.log of type Other and Path..\.. Note: If the script is called OMAnimator.cfg, it automatically runs when the animation is started. This script must be located in the project directory. 17. Confirm the animation is stopped. Select the TestScript.log file in the browser, right-click and select Edit File. 18. Examine the file: Copyright IBM Corp Lab 5-17

84 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 9: Optional: Create an animated sequence diagram In this task, you create an animated sequence diagram for the model to see how often the isinneedofservice() operation is called. The isinneedofservice operation is called every time there is a change in the model. 1. Select the Default package, right-click and select Add New > Diagrams > Sequence diagram. 2. Name the new Sequence diagram isinneedofservice. 3. Click the System border icon in the drawing tools and drag it to the left side of the diagram. 4. Click the Dishwasher class in the browser and drag it to the diagram. Lab 5-18 Copyright IBM Corp. 2012

85 Lab 5 Panel diagrams 5. Click the Run executable icon to execute the model. 6. Confirm that an animated sequence diagram is created. It is named animated isinneedofservice. 7. Click the Go icon or press F4 and confirm that the animated sequence diagram starts as shown in the following diagram: 8. Generate the evstart event into the animated sequence diagram by selecting the event generator and choosing the evstart event when prompted. Copyright IBM Corp Lab 5-19

86 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 9. Confirm that the sequence diagram shows the animation sequence of completing the various cycles before going to off. Check how many times the isinneedofservice() operation is called. (The author had a result of six times after generating evstart.) Task 10: Optional: Replace the isinneedofservice guard by an event The frequent calling of the isinneedofservice guard might cause considerable overhead. Consider replacing the guard by an evfault event. Now you modify the statechart so that when cycles are changed, you can check to see if service is required. If service is required, an evfault event is generated. There are several workable ways that you can change the statechart. A simple way is presented below, but other valid options exist. In modeling, there are often several different ways to implement the same result. Two areas of the statechart require changing. The guard [isinneedofservice] is replaced by the event evfault. The transition from drying to done is also changed so evfault is generated. 1. Open the Dishwasher statechart, and by typing directly on it, change the [isinneedofservice()] guard to evfault. Lab 5-20 Copyright IBM Corp. 2012

87 Lab 5 Panel diagrams 2. On the transition from drying to done, make a new line after cycle++; and then add: if (isinneedofservice()) GEN(evFault); 3. Generate code, make and run the model. 4. With the isinneedofservice sequence diagram open, click Go. Confirm that an animated sequence diagram starts as shown: Copyright IBM Corp Lab 5-21

88 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 5. Generate the evstart event into the animated sequence diagram. 6. Confirm that isinneedofservice() is called only after isdrying(), so that isinneedofservice() is not called as frequently as before. Lab 5-22 Copyright IBM Corp. 2012

89 Lab 5 Panel diagrams Copyright IBM Corp Lab 5-23

90 Lab 6: Add classes to the Dishwasher model Objectives After completing this lab, you will be able to: Add two new classes to the Dishwasher model. Add actions on entry and exit. Initialize the new classes. Given You continue to build on the Dishwasher model that you created in lab 5. You add new classes Motor and FrontPanel. Scenario You use additional features of Rhapsody to improve your model. You use test scripts to perform tasks. Copyright IBM Corp Lab 6-1

91 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 1: Add two new classes to the dishwasher model 1. Rename the object model diagram Model1 to Dishwasher System Overview. 2. On the object model diagram resize the Dishwasher class to make it smaller. To set the default size of any future classes that you draw, select the Dishwasher class, right-click and select Make Default. Select New Element Size and Project in addition to what is already selected. 3. In the Dishwasher System Overview object model diagram in the Dishwasher project add two new classes Motor and FrontPanel to the diagram. 4. Draw an aggregation from the Dishwasher to the Motor and a directed association from the FrontPanel to the Dishwasher. Lab 6-2 Copyright IBM Corp. 2012

92 Lab 6 Add classes 5. Right-click the aggregation from Dishwasher to the Motor and change the association so in the consists of field is End itsmotor. Copyright IBM Corp Lab 6-3

93 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 6. Right-click each association and select Display Options. Verify the name for both associations. The role name, for example itsmotor, is the name by which the Dishwasher knows the Motor. This name appears in the generated code. The association name, however, is rarely used. For association itsmotor, the association name might be set to something such as switches or controls. 7. Open the Features > Operations tab of the Motor class and add two primitive operations on() and off(). Accept the defaults for Visibility and Return type. You do not have to add an implementation. Lab 6-4 Copyright IBM Corp. 2012

94 Lab 6 Add classes 8. On the Windows toolbar, select the Active Code View icon and click the itsmotor association to see the generated code. Task 2: Modify the Dishwasher statechart to add an action on entry and exit A class is a rich type. It is a type containing a "record structure", the attributes of the class, and the operations that might be applied to its attributes. An object is basically a variable that is defined by the class. Each object has its own set of fields that represent the attributes defined by the Class type. The class defines the operations that can be called on the object. In this next task, you can see in the Object Model diagram that you just modified that itsmotor is a pointer to a Motor class. If the Dishwasher wants to call a public operation of the Motor class, such as the on() operation, then it can do so by dereferencing this pointer: a. itsmotor->on(); b. itsmotor->off(); The motor is a class and itsmotor is the object. 2. Open the features of the On state. a. In the Action on entry field, type itsmotor->on(); Copyright IBM Corp Lab 6-5

95 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook b. In the Action on exit field, type itsmotor->off(); 3. You see the symbol in the upper left of the on state indicating that there is an entry on action and on exit. Click the symbol to see the details of the actions in the upper left as shown in the following picture: Note: If you do not see the entry and exit actions on the on state, confirm that the show Actions on Entry and Actions on Exit check box is selected on the display options. Lab 6-6 Copyright IBM Corp. 2012

96 Lab 6 Add classes Task 3: Add a statechart to the FrontPanel class Imagine that there is an interrupt that occurs every time a key is pressed on the FrontPanel class. This interrupt routine could read the keys and then send an event to the FrontPanel that passes an argument indicating which key has been pressed. In this task you add a new statechart to the FrontPanel class. 1. Right-click the FrontPanel class in the browser and select Add New > Diagrams > Statechart. 2. Add a new state named idle to the statechart. 3. Add a transition to itself on the idle state and type: evkeypress/processkey(params->key); 4. Right-click the evkeypress event, and add a key argument of type int. Copyright IBM Corp Lab 6-7

97 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Note that when an event has an argument, Rational Rhapsody provides a pointer called params that you can use on the transition where the event occurs, to get access to the argument. Task 4: Add operation processkey In this task you add a private operation with an implementation to the FrontPanel class. 1. Right-click the FrontPanel class and add a private operation processkey to the FrontPanel class. Lab 6-8 Copyright IBM Corp. 2012

98 Lab 6 Add classes 2. Add an argument akey of type int and implementation as follows: switch (akey) { case 0: itsdishwasher->gen(evstart); break; case 1: itsdishwasher->gen(evopen); break; case 2: itsdishwasher->gen(evclose); break; case 3: itsdishwasher->gen(evservice); break; case 4: itsdishwasher->gen(evmode); break; default: break; } Or:: Use the CheatSheet.txt file to copy and paste the implementation into the processkey operation. Note: GEN is a macro that you can use to send an event to another object, which means that itsdishwasher->gen(evstart) is the same as itsdishwasher->send(new evstart()). Copyright IBM Corp Lab 6-9

99 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Send is an operation of the base class OMReactive. Task 5: Initializing the objects At run time, objects are created for the classes in the project. Objects are typed or defined by the classes. Your instructor might have explained the different ways to initialize the objects that will be typed by the Dishwasher, FrontPanel, and Motor. Now you implement the solution to use another new class that has the responsibility to create all the instances and to initialize the relations. Sometimes a structured class is called a composite class. 1. In the browser, add a class called DishwasherBuilder. 2. Add a Structure diagram to the class called DishwasherBuilder Structure. To do this, right-click the DishwasherBuilder class in the browser and select Add New > Diagrams > Structure diagram. Lab 6-10 Copyright IBM Corp. 2012

100 Lab 6 Add classes 3. Drag the three classes from the browser (FrontPanel, Dishwasher, Motor) to the new structured class.. 4. Select the three classes inside the DishwasherBuilder by pressing the Shift key, right-clicking the classes, and selecting Make an Object. An object inside a class is called a part. Copyright IBM Corp Lab 6-11

101 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 5. Press the Delete key to remove the associations between the objects from the Structure diagram. The associations must stay in the project, so you are just deleting them from view in the DishwasherBuilder Structure diagram. 6. Draw a link from itsfrontpanel to itsdishwasher and from itsdishwasher to itsmotor. Lab 6-12 Copyright IBM Corp. 2012

102 Lab 6 Add classes Task 6: Execute the model Now you create an initial instance of the DishwasherBuilder. The DishwasherBuilder then creates all the objects and initializes the relations between them. 1. Choose the Sim configuration of the Test component by selecting it in the configuration box or in the browser. 2. In the Features > Initialization tab of the Sim configuration, select Derived in Initial Instances and select DishwasherBuilder in the list. Note: Derived means to generate code for just the classes that are necessary based on the initial instances. Copyright IBM Corp Lab 6-13

103 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 3. Click Save. Then Generate, Make, and Run. 4. When you have a build with no errors and the model is running, click Go or press F4. 5. Verify that all the instances are created and that all the relations are initialized as shown in the following screen capture: Lab 6-14 Copyright IBM Corp. 2012

104 Lab 6 Add classes 6. Confirm that the two relations are initialized by opening the Features of each new instance and confirm that the relation is present. Copyright IBM Corp Lab 6-15

105 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 7: Create a sequence diagram to test Now you create an animated sequence diagram. You generate an evkeypress event into the FrontPanel on the animated sequence diagram. The purpose is to test the behavior. 1. Create a sequence diagram called Builderseq. Do this by selecting the Sequence diagram category in the browser, right-click, and select Add New > Diagrams > Sequence Diagram. Drag the system border to the sequence diagram (Env). 2. Drag the FrontPanel class to the diagram, drag the Dishwasher class to the diagram, and drag the Motor class to the diagram. 3. Save the project. Generate, Make, and Run. Click Go. 4. Confirm that an animated Builderseq diagram is created. 5. Click the event generator icon to generate an event into the animated sequence diagram. 6. In the events dialog, select as the object the instance DishwasherBuilder[0]->itsFrontPanel. 7. Select the evkeypress event. Edit the key argument by entering a value of 0. Lab 6-16 Copyright IBM Corp. 2012

106 Lab 6 Add classes 8. Click Generate. Examine the animated sequence diagram and confirm that it starts such that evkeypress(key=0) calls processkey(akey=0). Copyright IBM Corp Lab 6-17

107 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Lab 6-18 Copyright IBM Corp. 2012

108 Lab 7: Web-enable the dishwasher model Objectives After completing this lab, you will be able to: Web-enable the dishwasher model. Add an AC and DC motor to the dishwasher. Edit the code and roundtrip the changes back to the model. Given You continue to build on the dishwasher model that you created in the lab 6. Copyright IBM Corp Lab 7-1

109 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 1: Generate a web page In addition to model execution, another way to test your model is to generate a web page. In this exercise you use the Rhapsody feature Webify with animation. 1. In the Features > Settings tab for the Sim configuration, under Webify select Web Enabling.. 2. On the General tab, set the stereotype to «Web Managed in PredefinedTypes Cpp» for all the attributes in the Dishwasher class and all the events in the Default package. Also, set the same stereotype «Web Managed in PredefinedTypes Cpp» for the setup() operation. Lab 7-2 Copyright IBM Corp. 2012

110 Lab 7 Webify Copyright IBM Corp Lab 7-3

111 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 3. Create a hyperlink by selecting the Test component right-click and select Add new > Relations > Hyperlink. Complete the Link Target field with and select Target name. 4. Click Save, and click Generate / Make / Run. Click Go. Be sure the model is running. 5. Open Internet Explorer: Type: Click the hyperlink. 6. Confirm that the Webified project opens. Lab 7-4 Copyright IBM Corp. 2012

112 Lab 7 Webify Task 2: Turning the motor into an interface class In this task you turn the motor into an interface class. You make the Motor operations abstract. If you make the motor operations abstract (the virtual <type name()>=0), you cannot put any logic in the method of this class. Instead, you must place logic in a method of the derived class. 1. Open the object model Dishwasher System Overview diagram that shows the Motor class. 2. Edit the Motor features to add the «Interface in Predefined Types» stereotype to the Motor class. 3. Select the abstract check box for the on() and off() operations of the Motor class. Copyright IBM Corp Lab 7-5

113 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 4. Generate code and examine Motor.h. Observe the pure virtual declaration of the on() and off() operations. Task 3: Add two new classes to the diagram Now you add an AC and a DC class to the diagram. 1. Add an AC and a DC class to the Dishwasher System Overview diagram beneath the Motor class. Lab 7-6 Copyright IBM Corp. 2012

114 Lab 7 Webify 2. Click the realization icon on the drawing tools, to add a realization from the AC class to Motor and from the DC class to Motor. 3. Right-click the AC class and select Realize Base Classes. 4. A dialog box opens, in which you can implement the abstract operations and optionally implement the virtual operations. Copyright IBM Corp Lab 7-7

115 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 5. Check the off() box. The Edit Code option is enabled. 6. Click Edit Code. Add the following code: std::cout << AC Motor off << std::endl; Note: Because you are using the Cygwin compiler in this class, std must be added at the beginning and end of the code. 7. Select the on() check box and click Edit Code. Add the following code: std::cout << AC Motor on << std::endl; Lab 7-8 Copyright IBM Corp. 2012

116 Lab 7 Webify 8. In the Filter View check Implemented.. Task 4: Using the derived class Motor is abstract, therefore you cannot instantiate it,, so the AC class is used instead. Recall from Task 2 that the Motor class operations were abstract. In this task you use the derived class, AC, instead of the Motor class. 1. Highlight the itsmotor part in the DishwasherBuilder composite class and select Delete from Model. 2. Drag the AC class to the DishwasherBuilder composite class from the browser. 3. Right-click the AC class and select Make an Object, and then right-click AC to make an object. 4. On the Dishwasher Builder Structure diagram, drag the AC part to the diagram from the browser. Copyright IBM Corp Lab 7-9

117 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 5. Because you deleted the Motor class and added the AC class, you must create a link to AC from the Dishwasher on the DishwasherBuilder Structure diagram. 6. Right-click the new link and Select Association to instantiate. Confirm that itsmotor appears to the right of Select Association to instantiate. Lab 7-10 Copyright IBM Corp. 2012

118 Lab 7 Webify Task 5: Execute the model 1. Generate, make, and run the model. Click Go. 2. Create a new sequence diagram or use the Builderseq sequence diagram that you created in the previous lab. If you create a new one, drag the system border, FrontPanel, and Dishwasher classes to the new sequence diagram.. 3. Animate the sequence diagram by clicking Tools > Animated sequence diagram. 4. Click the Generate event icon. In the events dialog box, select DishwasherBuilder[0]->itsFrontPanel as the object the instance. Copyright IBM Corp Lab 7-11

119 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 5. Assign the evkeypress(0) a value of Inject evkeypress(0) to the FrontPanel. Check that you see the following output: Note: No code changes have been made in the Dishwasher, but it is now using AC as its motor. Task 6: Optional exercise Now consider how to modify the model so that either an AC or a DC Dishwasher can be created. The pictures below provide some clues. Lab 7-12 Copyright IBM Corp. 2012

120 Lab 7 Webify Copyright IBM Corp Lab 7-13

121 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Lab 7-14 Copyright IBM Corp. 2012

122 Lab 7 Webify Tip:The code will call the correct motor class. You can verify this by putting std::cout<<"starting AC motor"<<std::endl; in the AC motor's on() method and std::cout<<"starting DC motor"<<std::endl; in the DC motor's on() method. Copyright IBM Corp Lab 7-15

123 Lab 8: Setting up the cash register Objectives After completing this lab, you will be able to: Use a profile applied to a project Add requirements to the model from a Word document through the Gateway Add a cover link from the model to the requirements Analyze and view the text of the requirements in the Gateway Add a use case diagram to the model Add hyperlinks from one element to a diagram in the project. Given In this lab, you practice what you learned in the previous labs and apply the concepts you learned to another project. The starting requirements are: A small stand-alone cash register needs to be designed that reads barcodes of products that a customer has selected. When a product has been identified, its name and price are displayed on a display. If the barcode cannot be read automatically, the message "Unknown product" is displayed and the barcode can be entered via the cashier s keyboard. When all the selected products have been read, a ticket is generated containing the list of all the selected products with the unit price, quantity, and total price. Additional cash register requirements: Some products can be on special offer. It must be possible to add special offers such as "Buy one get one free", "10% off ", or "Buy 3 for 1 Euro". Products can be cancelled one at a time. A keyboard allows the cashier to start a session, cancel the last selected product, end a session, and issue a ticket. It must be possible to change hardware platforms in the future. The cash register will contain a local database of products. In various places, it is necessary to type several lines of code. To save time, a cheat sheet is available to allow text to be cut and pasted. During the exercises, look for the note indicating that text can be cut and pasted from the cheat sheet. In order to optimize the allocated classroom time, it is not necessary to enter descriptions, but in a real project it is very important to enter descriptions. Without descriptions, the final documentation will be much less useful. Copyright IBM Corp Lab 8-1

124 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 1: Group exercise Spend time working with your team and analyzing the requirements to devise use cases and actors. In addition, find some classes and draw an Object Model Diagram showing how these classes are connected. Task 2: Getting set up for the Cash Register For the Cash Register exercise, you will use a profile to be provided by the instructor. 1. Copy the provided CPP profile from the Input folder into the \Share\Profiles directory. When you create a project, you can create it based on this profile. 2. Create a new project called CashRegister in C:\work, and select a Project Type of CppProfile. Lab 8-2 Copyright IBM Corp. 2012

125 Lab 8 -The Cash Register Task 3: Examine the profile The model now contains a read-only reference to the CppProfile. 1. Select the CppProfile in the browser, right-click to see the Features dialog and select the Properties tab. In Properties select View Locally Overridden at the top left, examine the profile, and observe the properties that have been overridden and the stereotypes that have been added. Note, for instance, that all diagrams now have a frame. Copyright IBM Corp Lab 8-3

126 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 2. Add a simple description to the project. Right-click CashRegister, open Features > Description, and enter the following description: Cash Register exercise for the Rational Rhapsody Essentials training based on the profile CppProfile. When you generate a report on the model, all descriptions that are entered, like this one, can appear in the final documentation. Task 4: Add requirements to the model In this task, you add requirements provided to you. The requirements are in the same folder where you found the CPP profile. The requirements are in a document titled Cash_Register_Requirements.doc. The requirements are identified by the Gateway using a specific Word style. Lab 8-4 Copyright IBM Corp. 2012

127 Lab 8 -The Cash Register 1. Rename the existing package Default to RequirementsPkg. 2. Right-click RequirementsPkg and select the Word document using Add New > Annotations > Controlled File. 3. Click OK when prompted to copy the Word file to the.rpy directory. Copyright IBM Corp Lab 8-5

128 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 4. Right-click CashRegister at the top level of the project. Open the Rational Rhapsody Gateway by right-clicking and select Rational Rhapsody Gateway > Open. Note: If you do not have Rational Rhapsody Gateway, you could either manually add the requirements or simply skip this task. Lab 8-6 Copyright IBM Corp. 2012

129 Lab 8 -The Cash Register 5. In the Gateway, select Edit Project to open the configuration editor. 6. Drag the Word document (from the CashRegister_rpy directory) into the main window of this view so it resides with the UML Model. 7. Add a cover from the UML Model to the Word document. The cover indicates that the UML Model covers the Word document (and also covers itself, in case you add any derived requirements). Copyright IBM Corp Lab 8-7

130 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 8. Click OK and then Yes to analyze the Word document. In the Rational Rhapsody Gateway Management view, you can see that the Rational Rhapsody Gateway has extracted the requirements from the Word document. Lab 8-8 Copyright IBM Corp. 2012

131 Lab 8 -The Cash Register The coverage is 0% because the requirements are not yet linked to any Rational Rhapsody design elements. 9. Examine the text of the Requirement that appears in the Rational Rhapsody Gateway when you click the Coverage Analysis View tab and click a requirement. Copyright IBM Corp Lab 8-9

132 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 10. Highlight UML Model Rhapsody in Gateway and select Tools > Add high level requirements from the top menu bar. Select RequirementsPkg and click OK. Lab 8-10 Copyright IBM Corp. 2012

133 Lab 8 -The Cash Register Nine requirements are now added to your model. 11. Click OK and Yes to reload. 12. Close the Rational Rhapsody Gateway. 13. In Rational Rhapsody, confirm that you now see the imported requirements: Later, you will connect these requirements to the elements of the model that implement them. Copyright IBM Corp Lab 8-11

134 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 14. Add a new AnalysisPkg package to the Packages category. Task 5: Add a use case diagram 1. Add a new Principal Uses use case diagram to AnalysisPkg by selecting AnalysisPkg, right-clicking, and selecting Add New > Diagrams>Use Case Diagram. 2. Add three actors to the use case diagram by clicking the actor icon on the Diagram tools. Name the actors Cashier, Manager, Customer. 3. In the middle of the diagram, draw a boundary box and title it Cash Register System. Move the actors outside the boundary box. Lab 8-12 Copyright IBM Corp. 2012

135 Lab 8 -The Cash Register 4. Add two use cases in the boundary box and name them as follows: Sum the cost of selected products, Configure the products. 5. Add an association between Manager and Configure the products, using the association icon on the diagram tools. 6. Add an association between Cashier and Sum the cost of selected products. 7. Add an association between Customer and Sum the cost of selected products. Task 6: Add an image to a diagram In this task you add a.jpg image to the use case diagram. You add Cashier.jpg as a controlled file to AnalysisPkg. All descriptions are in the cheat sheet and Cashier.jpg is given to you. 1. Select AnalysisPkg, right-click and select Add New >Annotations> Controlled File. Browse to find Cashier.jpg in the provided files folder Input.. Select Yes when prompted with the question: Do you want to move the controlled file to the.rpy directory? Copyright IBM Corp Lab 8-13

136 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 2. Select the Cashier actor, right-click and select Associate Image to associate this.jpg to the Cashier actor. 3. Examine the use case diagram to confirm that the image of a cashier appears. Lab 8-14 Copyright IBM Corp. 2012

137 Lab 8 -The Cash Register 4. Add descriptions to the use case diagram elements. Use the cheat sheet to copy and paste the descriptions into the Features > Description of the actors, or type the following text into the description: Manager - The Manager sets the prices and special offers for all the products. Cashier - The Cashier is the principal actor. In a typical scenario, they will take the products presented by the Customer, and scan them one by one. When all the products have been scanned, they will print out a ticket, take payment from the Customer and finally give the ticket and products to the Customer. Customer - The Customer will select a number of products and then present them to the Cashier. The Customer will then pay and take the products away. 5. Add a description to the principal use case: Sum the cost of selected products: Actors: Copyright IBM Corp Lab 8-15

138 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Customer and Cashier Preconditions: Cash Register must be initialized, and there must be products in the Product Database. Postconditions: None Main Success scenario: The Customer selects a number of products, and presents them to the Cashier. The Cashier then scans the products one by one, issues a ticket, accepts payment and then gives the customer the ticket and the products. Exceptions: 1. If a barcode cannot be read correctly, then the Cashier must enter the code via the keyboard. 2. The last product scanned can be cancelled. 3. If all the products have been cancelled and the cancel key is again pressed, then the session is cancelled. 6. Add a description to the Configure the products use case: Actors: Manager Preconditions: None Postconditions: The CashRegister is now ready to be used Main Success Scenario: The Manager will configure the CashRegister's database so as to have knowledge of each product as well as the price, name, barcode and special offer associated with each product. Exceptions: None Lab 8-16 Copyright IBM Corp. 2012

139 Lab 8 -The Cash Register Task 7: Draw another use case diagram 1. Right-click the Use case diagrams category and select Add New use case diagram. 2. Name it Secondary Uses. f 3. Drag the Sum the cost of selected products use case to this diagram. 4. Add three new use cases as follows: Keep count of selected products, Generate a ticket showing total cost, Manage special offers. 5. Draw an include from the Sum the cost of selected products to each of the three new use cases. Note: You can select Stamp mode icon three separate times. in the diagram tools to save you the need to click the include Copyright IBM Corp Lab 8-17

140 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 6. For the Keep count of selected products use case, add the following description: Actors: Customer and Cashier Preconditions: The CashRegister is not already being used for another Customer Postconditions: None Main Success scenario: The Cashier starts a session, scans each product. When all the products have been scanned, a ticket is printed. Exceptions: 1. The barcode cannot be read automatically and must be entered via the keyboard 2. The last product scanned is cancelled 3. All the products have been cancelled and cancel is pressed again in which case the session is cancelled. 7. For the secondary Generate a ticket showing total cost use case, enter the following description: Actors: Cashier Preconditions: Lab 8-18 Copyright IBM Corp. 2012

141 Lab 8 -The Cash Register A session is in progress Postconditions: None Main Success scenario: The appropriate price of each product is calculated according to how many of each product have been selected. Finally the ticket is printed showing each product with name, quantity, unit price and total price. Exceptions: 1. If there are no products selected, then a ticket should still be printed out. 8. For the secondary Manage special offers use case, you could add the following description: Actors: Cashier Preconditions: A ticket is being printed; the manager has assigned special offers to products Postconditions: None Main Success scenario: The appropriate price of each product takes into account any special offer that might be associated with a product. Exceptions: None Task 8: Navigation optional exercise In order to navigate within the model, you can add internal hyperlinks for each model element. For example, it would be useful to be able to navigate from the Principal Uses diagram to the Secondary Uses diagram. 1. Select the Sum the cost of selected products use case in the browser. Right-click and select Add New > Relations > Hyperlink. 2. Right-click to open the features for the hyperlink and set the hyperlink to point to the Secondary Uses diagram. Click the Target name button. Copyright IBM Corp Lab 8-19

142 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 3. Go to the Principal Uses use case diagram, right-click the Sum the cost of selected products use case, and select Navigate > Hyperlink > Secondary Uses. Confirm that the hyperlink navigates to the Secondary uses use case diagram. Lab 8-20 Copyright IBM Corp. 2012

143 Lab 9: Use Case 1: Configure the products Objectives After completing this lab, you will be able to: Add detail and diagrams for the first use case: Configure the products Add interfaces Draw classes and relations Add a constructor Create a qualified association Make classes objects Generate, build, and animate the model Given This lab follows the previous lab by further developing the first use case. In addition, you will also put together an architecture that works for all use cases. There are many different architectures that could be used. Requirement REQ8 indicates that you must design the CashRegister so that hardware platforms can be changed in the future. If you change the hardware platform, it is likely you will have to change the implementation for the Printer, Display, Keyboard, and BarcodeReader classes. To make it easier to change these classes in the future, you could introduce some interface classes. Copyright IBM Corp Lab 9-1

144 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 1: Create the cash register package 1. Right-click the Packages category and select Add New Package. Name the new package CashRegisterPkg. 2. Move the Model1 Object Model diagram to this package and rename it to CashRegisterOverview. 3. Right-click the Object Model Diagrams (OMD) category and select Add New Object Model Diagram. 4. Name the new diagram Domains Overview. 5. Drag the Analysis package from the browser to the new Domains Overview diagram. Resize the Analysis element on the diagram to make it smaller. 6. Right-click the Analysis package on the diagram and select Make Default. 7. Select New Element Size and Project as shown in the previous figure. 8. Drag the CashRegisterPkg and the RequirementsPkg to the Domains Overview diagram. 9. Right-click the Packages category and select Add New Package. Name the new package HardwarePkg. Lab 9-2 Copyright IBM Corp. 2012

145 Lab 9 Use case Right-click the Packages category and select Add New Package. Name the new package InterfacesPkg. 11. Drag the HardwarePkg and the InterfacesPkg to the diagram. 12. Using the dependency icon on the diagram tools, draw a dependency from the HardwarePkg to the InterfacesPkg. 13. Draw a dependency from the CashRegisterPkg to the InterfacesPkg. The previous diagram indicates that there are no dependencies between HardwarePkg and CashRegisterPkg. Classes inside these two packages communicate via classes inside the InterfacesPkg only. This means that you can easily replace the HardwarePkg by another hardware package in the future without having to modify the CashRegisterPkg. Task 2: Add interfaces The interfaces package contains all our interface classes that will be used by the CashRegisterPkg and the HardwarePkg. 1. Right-click the InterfacesPkg and select Add New interface. Add the following new interfaces to the InterfacesPkg: IBarcodeReader, IDisplay, IKeyboard, IPrinter 2. On the CashRegisterOverview diagram, draw the CashRegister class using the class icon on the drawing toolbar. Copyright IBM Corp Lab 9-3

146 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 3. Click to convert the view from Specification to Structure view. Ensure that an element is selected on the diagram so you see the specification structure view icon. 4. Add a hw port to the CashRegister structure as shown. 5. Open the features for the hw port by right-clicking it. On the Features > Contract tab, add a provided interface to IBarcodeReader and IKeyboard. Lab 9-4 Copyright IBM Corp. 2012

147 Lab 9 Use case 1 6. On the Features > Contract tab, add a required interface to IDisplay and IPrinter. Copyright IBM Corp Lab 9-5

148 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 7. Add a description to the CashRegister class. Use the cheat sheet to cut and paste the description, as follows: This is the controlling object that receives commands via the barcode and keyboard ports. It sends messages to a display and printer via the display and printer ports. It manages a list of products. It uses the ProductDatabase to identify products from a barcode. 8. Add a new Object Model Diagram in the CashRegisterPkg called ProductDatabase Overview. 9. Drag the CashRegister class from the browser to the ProductDatabase Overview diagram. 10. You can choose to hide or show ports via the Ports dialog. To do either, right-click the class and select Ports > Hide ports or Show ports. Task 3: Draw more classes and relations 1. Add 2 new classes - the Product and ProductDatabase classes to the ProductDatabase Overview object model diagram. Lab 9-6 Copyright IBM Corp. 2012

149 Lab 9 Use case 1 2. Add the following relations between classes: a. Add a Composition relation from CashRegister to ProductDatabase. b. Add a Directed association from ProductDatabase to Product. c. Add an aggregation from CashRegister to Product. 3. Change the Composition relation from CashRegister to ProductDatabase to be directed. Copyright IBM Corp Lab 9-7

150 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Change the aggregation from CashRegister to Product to be directed. Now your diagram looks as follows: Lab 9-8 Copyright IBM Corp. 2012

151 Lab 9 Use case 1 4. Set the multiplicity on the relation between ProductDatabase and Product and on the relation from CashRegister to Product. Copyright IBM Corp Lab 9-9

152 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Lab 9-10 Copyright IBM Corp. 2012

153 Lab 9 Use case 1 5. Add the following attributes for the Product class: a. Add an attribute barcode of type int. b. Add an attribute name of type char*. c. Make the attribute name a constant. Copyright IBM Corp Lab 9-11

154 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook d. Add an attribute unitprice of type int. Lab 9-12 Copyright IBM Corp. 2012

155 Lab 9 Use case 1 6. Change the Display options on the Product class to show the attributes. Copyright IBM Corp Lab 9-13

156 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 4: Add a constructor 1. Right-click the Product class and select Add new > Constructor. 2. Add the following arguments to the constructor: a. Add an argument abarcode of type int. b. Add an argument aname of type char*. c. Add an argument aunitprice of type int. d. In the Features > General tab, add an initializer: barcode (abarcode), name(aname), unitprice(aunitprice) Lab 9-14 Copyright IBM Corp. 2012

157 Lab 9 Use case 1 3. By default, Rational Rhapsody generates an implicit constructor for all classes. To prevent this, set the GenerateImplicitConstructors property for the Product class by clearing it. Copyright IBM Corp Lab 9-15

158 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 4. Using the Active Code View icon, select the relation between the ProductDatabase and the Product class. When the multiplicity for a relation is * (many), Rational Rhapsody generates an unbounded collection using the template class OMCollection<Product*>. This is similar to a bag. You can put many products in it and also take them out. 5. Select the Ordered property for the relation. Lab 9-16 Copyright IBM Corp. 2012

159 Lab 9 Use case 1 Note: Instead of setting the Ordered property, you could have applied the stereotype «Ordered» that is in the profile. Note: When the multiplicity for a relation is * (many) and the property Ordered is True, then Rational Rhapsody generates a linked list using the template class OMList<Product*>. Task 5: Create a qualified association A responsibility of the ProductDatabase class is to allow other classes to find a product given a barcode. You might have thousands of products, and you want to look up a product as quickly as possible. 1. On the relation between the ProductDatabase and the Product class, add barcode as a Qualifier on End1. Copyright IBM Corp Lab 9-17

160 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook When the multiplicity for a relation is * (many) and the relation is qualified with a key, a map is generated using the template class OMMap<key,Product*>. 2. By looking at the code, you can see that many useful operations have been generated. However, you do not need all these operations, but only the following two: getitsproduct and additsproduct, as shown below in the active code view for ProductDatabase.h: Lab 9-18 Copyright IBM Corp. 2012

161 Lab 9 Use case 1 Task 6: Generated operations You can set properties to tell Rational Rhapsody not to generate the other operations. There is a stereotype in the profile that you can apply to do this. Copyright IBM Corp Lab 9-19

162 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 1. On the relation between ProductDatabase and Product, apply the stereotype «SimplifiedAccess». Lab 9-20 Copyright IBM Corp. 2012

163 Lab 9 Use case 1 Copyright IBM Corp Lab 9-21

164 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Now you can use these two operations to add products to the map and to get a product given a specific barcode. Task 7: Creating Products 1. Create a constructor for ProductDatabase, 2. Add to the constructor the following implementation: additsproduct ( 12344, new Product( 12344, "Coconuts", 180 )); additsproduct ( 12345, new Product( 12345, "Lychees", 250 )); additsproduct ( 12346, new Product( 12346, "Kiwis", 120 )); additsproduct ( 12347, new Product( 12347, "Pears", 100 )); additsproduct ( 12348, new Product( 12348, "Pommegranates", 199 )); additsproduct ( 12349, new Product( 12349, "Watermelons", 350 )); Note: You can cut and paste this implementation from CheatSheet_UC1.txt. Task 8: Create a Tester package In this task you create some tester hardware to connect to the Cash Register. 1. Inside the HardwarePkg, add a new nested package called TesterPkg with the following object model diagram titled Tester Overview. 2. Add a class to the diagram and name it Tester. Lab 9-22 Copyright IBM Corp. 2012

165 Lab 9 Use case 1 Task 9: Tester port Now you need to add a port to the Tester class that has exactly the opposite contracts to the port on the CashRegister class. 1. The easy way to do this is to go to the browser and find the hw port of the CashRegister. Then, press Ctrl and drag the port to the Tester class in the browser. 2. Set the new port to be Reversed. Copyright IBM Corp Lab 9-23

166 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 3. Add a TesterBuilder class to the Tester package. 4. Add a structure diagram to the TesterBuilder class. 5. Drag the Tester class from the browser to the TesterBuilder structure diagram. Lab 9-24 Copyright IBM Corp. 2012

167 Lab 9 Use case 1 6. By default, Rational Rhapsody shows the class with the attributes and operations fields. 7. Change the size of the Tester class to be smaller, then right-click and select Make Default Select New Element Size and Project. Copyright IBM Corp Lab 9-25

168 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 8. Remove the Tester class from the view (right-click and Remove from View). Then drag both the CashRegister and the Tester classes from the browser to the TesterBuilder class on the Structure diagram. Notice that the classes should now appear with the new default size. Task 10: Make an object 1. Select both the Tester and the CashRegister classes, right-click and select Make an Object. 2. Connect the ports of the Tester and CashRegister objects with a link. Lab 9-26 Copyright IBM Corp. 2012

169 Lab 9 Use case 1 3. Rename the existing DefaultComponent to TesterPrototype. 4. Open the features of the TesterPrototype, and in the Scope tab select Selected Elements. The scope means the packages that you want to generate code for. 5. Select the CashRegisterPkg, the TesterPkg, and the InterfacesPkg. Copyright IBM Corp Lab 9-27

170 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 6. Rename the existing DefaultConfig configuration to Debug. 7. Open the features of the Debug configuration. In the Settings tab set the Instrumentation Mode to Animation. Lab 9-28 Copyright IBM Corp. 2012

171 Lab 9 Use case 1 v 8. Create an initial instance of TesterBuilder by selecting TesterBuilder for initialization. To do this, select the Debug configuration and open the Features > Initialization tab. Select TesterBuilder. Copyright IBM Corp Lab 9-29

172 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 9. Clear Generate Code For Actors (as shown above). 10. Save then Generate / Make / Run. Ignore the warnings during the code generation; you will deal with those warnings later. Lab 9-30 Copyright IBM Corp. 2012

173 Lab 9 Use case Click Go Idle to create the objects. Copyright IBM Corp Lab 9-31

174 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook c Note: If you do not see the objects as shown above, examine your model for any errors. If you do see any errors speak to your instructor for assistance. 12. Switch from Entire Model View to Animation View. Lab 9-32 Copyright IBM Corp. 2012

175 Lab 9 Use case Check that each object is initialized correctly. 14. Double-click the instance for CashRegister. Confirm that you see the relations as follows: 15. Open the Features for the instance of Product(0) and confirm the attributes: Copyright IBM Corp Lab 9-33

176 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 16. Open the Features for the instance of Product(1) and confirm the attributes: 17. Open the Features for the instance of Product(2) and confirm the attributes: Lab 9-34 Copyright IBM Corp. 2012

177 Lab 9 Use case 1 I 18. Open the features of the instance for ProductDatabase and confirm the relations: Copyright IBM Corp Lab 9-35

178 Lab 10: Use Case 2: Keep track of selected products Objectives After completing this lab, you will be able to: Add detail and diagrams for the second use case: Keep track of selected products Develop the model further with sequence diagrams. Given For this use case there are several scenarios that must be drawn in order to help describe how the cash register works. The following scenarios are described by using sequence diagrams: 1. Selecting products 2. Cancelling products 3. Manually entering a barcode Copyright IBM Corp Lab 10-1

179 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 1: Draw a sequence diagram 1. In the CashRegisterPkg, create an Analysis Sequence diagram titled Scenario selecting products. 2. Drag the Tester and CashRegister classes to the diagram. 3. Add a condition mark called idle to the CashRegister lifeline and two partition lines with text. The text on the first partition line is Initially the CashRegister is idle. The text on the second partition line is The Cashier presses the start session key. Lab 10-2 Copyright IBM Corp. 2012

180 Lab 10 Use case 2 4. Draw an event named evstart diagonally from the Tester to the CashRegister. 5. Add a reflexive message (closed arrowhead) startsession() on the CashRegister lifeline. 6. Add a horizontal message (closed arrowhead) show( Ready ) from CashRegister to Tester. 7. Add a condition mark named active to the CashRegister lifeline. Copyright IBM Corp Lab 10-3

181 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 8. Add an interaction operator. 9. In the Features for the interaction operator, select the type to be loop. 10. Change the Operands > Constraints from condition to until all products scanned. Lab 10-4 Copyright IBM Corp. 2012

182 Lab 10 Use case Add an interaction occurrence in the interaction operator. 12. Name the interaction occurrence Scan a product. Be sure that it sits on both lifelines. Copyright IBM Corp Lab 10-5

183 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 13. Complete the scenario by adding four more messages and a condition mark as follows: a. Draw an event evend() from Tester to CashRegister on the diagonal. b. On the CashRegister lifeline, add a reflexive closed arrowhead message after the evend() message and name it generateticket(). c. Add another reflexive message on the CashRegister lifeline and name it endsession(). d. Add the closed arrowhead message show( ) horizontally from CashRegister to Tester. e. Add a condition mark and name it idle. 14. Right-click the interaction occurrence Scan a product and select Create Reference Sequence Diagram. Lab 10-6 Copyright IBM Corp. 2012

184 Lab 10 Use case Drag the ProductDatabase class to the sequence diagram to the right of CashRegister. 16. Add the following messages: a. Add an event diagonally from Tester to CashRegister. Name it evbarcode(acode). b. Add a message from CashRegister to itself. Name it identifyproduct(acode). c. Add a horizontal message from Cashregister to ProductDatabase. Name it aproduct=getproduct(acode). Task 2: Add an interaction operator 1. Add an Interaction Operator,. 2. In the Interaction Operator add an Operand Separator across all three lifelines. Copyright IBM Corp Lab 10-7

185 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 3. Open the features for the Interaction Operator. Select alt from the Type list. 4. In Features, set the Constraints to be [aproduct == NULL] and [else]. 5. In the Interaction Operator, add three messages: a. From the ProductDatabase to the CashRegister lifeline, draw a horizontal message and name it show( Unknown barcode ). Lab 10-8 Copyright IBM Corp. 2012

186 Lab 10 Use case 2 6. On the CashRegister lifeline, add a reflexive message to itself and name it addproduct(aproduct). 7. Add a horizontal message from CashRegister to Tester and name it show( Added product ). Because you used an analysis sequence diagram, none of the messages that you drew have been realized, so they do not yet exist in the browser. When you are happy that the scenario is correct, you can select the unrealized messages and realize them. When you do this, any message that you drew diagonally becomes an event, and any message drawn horizontally or drawn to itself becomes a primitive operation. Before you proceed, check that the three messages evstart, evbarcode, and evend are the only messages drawn diagonally. If you had selected a Design sequence diagram, then as each message is drawn it would appear in the browser. Copyright IBM Corp Lab 10-9

187 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 3: Realize the sequence diagrams When you realize a sequence diagram, any event message that you have drawn diagonally becomes an event, and any message drawn horizontally or drawn to itself becomes a primitive operation. 1. For each sequence diagram, Scan a product and Scenario selecting products (do one at a time), select Edit > Select > Select Un-Realized. After the unrealized elements are selected on the diagram, select Edit > Autorealize. 2. Check that the messages have been realized and are shown in the browser: Lab Copyright IBM Corp. 2012

188 Lab 10 Use case 2 The show() operation is shown as being invoked on the Tester class. In fact, it is being called on the IDisplay Interface class. 3. Add an argument amsg of type char* to the Tester show() operation, and copy it to the Interface class IDisplay. Press Ctrl while dragging it. Copyright IBM Corp Lab 10-11

189 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 4. Add argument aproduct to the operation addproduct(). Select Product in CashRegisterPkg from the Type field and In from the Direction field. Lab Copyright IBM Corp. 2012

190 Lab 10 Use case 2 Note that the browser indicates that aproduct is of type Product. You can see that the product is passed as a pointer. Confirm this information is indicated in the browser as shown following: 5. Select the addproduct operation, View > Browser display options > Show Implementation Arguments. You can see the results in Active code view. Copyright IBM Corp Lab 10-13

191 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook By setting the direction In, Out, or InOut on an argument, you can control how you pass the arguments. In the profile that you are using, In, Out, and InOut have been set. 6. In the browser, select the evbarcode event and add an argument acode of type int. Lab Copyright IBM Corp. 2012

192 Lab 10 Use case 2 7. Because the tester is sending this event to the CashRegister, you must add the event reception to the Interface class IBarcodeReader. Select IBarcodeReader, right-click and select Add New>Reception. 8. Add argument acode of type int to the identifyproduct() operation in the CashRegister class. Copyright IBM Corp Lab 10-15

193 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 9. Add an argument acode of type int to the getproduct() operation in the ProductDatabase class. 10. Set the return type for getproduct in the drop-down menu to Product in CashRegisterPkg. It will then show up as Product. Lab Copyright IBM Corp. 2012

194 Lab 10 Use case 2 Now that the scenario is complete, you have populated the browser, which should look like the following image. Copyright IBM Corp Lab 10-17

195 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 4: Add another sequence diagram In this task, you create another sequence diagram and realize the messages. On this diagram, some of the same events from the previous task are used. 1. Create a new analysis sequence diagram by right-clicking Sequence diagrams in the browser and selecting Add New > Sequence diagram. Name it Scenario cancelling products. Lab Copyright IBM Corp. 2012

196 Lab 10 Use case 2 This scenario adds one more event evcancel, and two additional operations removelastproduct() and isnomoreproducts() to the browser. 2. Drag the Tester and CashRegister class to the diagram so the Tester is on the left and the CashRegister is on the right. 3. Draw a partition line. Type: Initially the CashRegister is active and several products have been added. 4. Add a condition mark on the CashRegister lifeline and name it active. Copyright IBM Corp Lab 10-19

197 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 5. Draw an event diagonally from Tester to CashRegister and name it evcancel. 6. Add an Interaction Operator and an Operand Separator. In the Features of the Interaction Operator, name the type alt and the constraint Products scanned. For the second constraint, instead of condition write else. 7. In the top section of the interaction operator on the diagram, draw a reflexive message on the CashRegister lifeline and name it false=isnomoreproducts(). 8. In the top section of the interaction operator on the diagram, draw another reflexive message on the CashRegister lifeline and name it removelastproduct(). 9. In the top section of the interaction operator on the diagram, draw a message from CashRegister to Tester and name it show( Cancelled product ). Lab Copyright IBM Corp. 2012

198 Lab 10 Use case Below the partition line, in the interaction operator on the diagram, draw a reflexive message on the CashRegister lifeline and name it true=isnomoreproducts(). 11. Add another reflexive message on CashRegister and name it endsession(). 12. Add a message show( ) from CashRegister to Tester. 13. Add a condition mark and name it idle on CashRegister. Copyright IBM Corp Lab 10-21

199 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 14. Select Edit > Select > Select unrealized. Then select Edit > AutoRealize to realize the messages on the sequence diagram. Check your browser and confirm that it shows the following operations: Lab Copyright IBM Corp. 2012

200 Lab 10 Use case 2 Note that in the previous image, the events evcancel(), isnomoreproducts(), and removelastproduct(), are new. Copyright IBM Corp Lab 10-23

201 Lab 11: Use Case 2: Keep track of selected products Statechart Objectives After completing this lab, you will be able to: Develop the model further with state machine diagrams. Build and run the model to validate it. Given For this use case you have previously drawn three sequence diagrams. From the scenarios, you have seen that the CashRegister receives events. You also added a couple of condition marks indicating states. Next you create a state machine diagram for the CashRegister. Copyright IBM Corp Lab 11-1

202 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 1: Create a statechart for CashRegister 1. Right-click the CashRegister class and select Add New > Diagrams > Statechart. Note that in the browser there are two entries for the new statechart. There is the actual statechart model and there is a graphical representation of the statechart. 2. In the Features name the new statechart model StatechartofCashRegister. Because the events already exist, you can right-click and select events from the list for the trigger field. The diagram is depicted below the instructions to create it. 3. Add two states to the statechart: idle and active. 4. Add a default transition to idle. 5. Add a transition from idle to the active. 6. On this transition from step five, add the event evstart in the trigger field and /startsession(); as the action. 7. Draw a transition from active to idle and add evend as the trigger and generateticket(); and endsession(); as actions. 8. Draw a transition from the active state to itself and add evbarcode as the trigger and identifyproduct(params->acode); as the action. 9. Add a condition connector to the left of active. Lab 11-2 Copyright IBM Corp. 2012

203 Lab 11 Statechart 10. Add a transition from active to the condition connector and add the event evcancel in the trigger field. 11. Add a transition from the condition mark to active and add the guard [else] and an action removelastproduct(); 12. Add a transition from the condition mark to the idle state and add [isnomoreproducts()] as the guard and endsession();as the action. Note: There should be a semi-colon after endsession() on the following diagram below. Task 2: Ordered relation As you can see in the statechart, because you have to be able to remove the last product added, the order of the products is important. Therefore, you must make the relation ordered. You could just set the property to ordered, but by adding a stereotype you have a visible indication that this is an ordered relation (and of course the property gets set for you). 1. On the ProductDatabase Overview Object Model diagram, on the relation between CashRegister and Product, for the relation itsproduct set the stereotype «Ordered». Copyright IBM Corp Lab 11-3

204 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 2. Add an implementation to the addproduct() operation of the CashRegister class. Note: You can use the CheatSheet_All.txt to copy and paste the implementation. Lab 11-4 Copyright IBM Corp. 2012

205 Lab 11 Statechart OUT_PORT is a Rational Rhapsody macro that allows a message to be sent via a port. There is no need to know what is connected to the port. Task 3: Enable accessors In the previous implementation, you called the accessor getname() for the Product. With the profile, accessors and mutators are not generated by default, so you must tell Rational Rhapsody to generate an accessor for the attribute name in the Product class. Later, you will use accessors for all the attributes in the Product class. The simplest way to do this is to enable accessors for all attributes in the class Product. 1. Select the Product class in the browser, right-click to open Features > Properties. 2. Select the AccessorGenerate property. Copyright IBM Corp Lab 11-5

206 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 4: Add a package as reference Because you have used sprintf in the implementation of addproduct, you must include stdio.h in the CashRegister class. In the previous exercises, you did this by setting the property CPP_CG::Class::ImpIncludes. This approach works, but there is a better visual way to do this. Now, add a package to this model from another model that contains the classes that you are interested in, for example, stdio. It is added as a reference. 1. As a reference, add the CppLibrary package to the model from the model RiCpp_Libraries. a. Select the CashRegister category at the top level. b. Select File > Add to Model, and browse to RiCpp_Libraries.rpy in the Input folder. c. Select the CPPLibrary.sbs from the list in the Add to model from Another Project dialog. Lab 11-6 Copyright IBM Corp. 2012

207 Lab 11 Statechart Now that you have added the stdio class to the model, you can start to use it. Note that it has the «External» stereotype indicating that you do not want to generate code for this class. Copyright IBM Corp Lab 11-7

208 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 2. Drag the stdio class from the >>External CPPLibraries>> package to the CashRegister Overview object model diagram and add a dependency from CashRegister to stdio with stereotype «Usage». Lab 11-8 Copyright IBM Corp. 2012

209 Lab 11 Statechart Task 5: Set the scope Unless the CppLibrary package is in the component scope, the dependency that you just added does not generate Copyright IBM Corp Lab 11-9

210 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook the required #include <stdio.h>. 1. Set the scope for the TesterPrototype component to include the CppLibrary package. 2. Add the implementation for the endsession() operation of the CashRegister class: Lab Copyright IBM Corp. 2012

211 Lab 11 Statechart a. In the Features > Implementation tab, add: OUT_PORT(hw)->show(" "); clearitsproduct(); clearitsproduct() is an operation that is generated automatically and clears (or empties) the linked list. Copyright IBM Corp Lab 11-11

212 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 3. Add the implementation for the IdentifyProduct() operation of the CashRegister class. Use the cheat sheet CheatSheet_UC2.txt. Lab Copyright IBM Corp. 2012

213 Lab 11 Statechart Task 6: isnomoreproducts operation change 1. Open the Features for the isnomoreproducts() operation. Make the selections so it returns a type int, and select inline and constant. Copyright IBM Corp Lab 11-13

214 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 2. Add the implementation for isnomoreproducts(): return itsproduct.isempty(); Lab Copyright IBM Corp. 2012

215 Lab 11 Statechart 3. Select Code > Generate and Code > Build. Verify that you do not have any build errors. If you think it is necessary, select Code > Regenerate and Code > Rebuild. Troubleshoot any errors you find. 4. Add the implementation for the removelastproduct() operation. Cut and paste it from CheatSheet_UC2.txt. 5. Add the implementation for the startsession() operation. Copyright IBM Corp Lab 11-15

216 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook OUT_PORT(hw)->show("Ready"); 6. Add the implementation for the getproduct() operation in the ProductDatabase class. return ( getitsproduct (acode) ); Lab Copyright IBM Corp. 2012

217 Lab 11 Statechart 7. Verify in the Features > General tab that it shows Returns > Type > Product in CashRegisterPkg. Task 7: Build and run the model 1. Close all diagrams particularly the sequence diagrams. 2. Click Save. Then Generate / Make / Run. Troubleshoot any build errors. Copyright IBM Corp Lab 11-17

218 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 3. Click Go. 4. Examine the browser: 5. Select Tools > Animated statechart. Select TesterBuilder[0}->itsCashRegister when you are prompted. Open and examine the animated StatechartofCashRegister. The idle state will be highlighted when it is animated. Lab Copyright IBM Corp. 2012

219 Lab 12: Use Case 2: Keep track of selected products animated sequence diagram Objectives After completing this lab, you will be able to: Animate the model with sequence diagrams and inject events. Build and run the model to validate it. Given You can capture what happens by opening an animated sequence diagram based on one of the scenarios, and then inject events. However, because there is no system border on the sequence diagrams, you do not see these events. So you have to create another sequence diagram. Task 1: Animate the model with sequence diagrams 1. Create a new sequence diagram in the sequence diagram folder and name it Behavior. 2. From the drawing toolbar, select a system border and add it to the Behavior diagram. Drag the Tester, CashRegister, and ProductDatabase classes onto the diagram. Copyright IBM Corp Lab 12-1

220 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 3. Close all the currently open diagrams (Window->Close All from the menu). It is especially important you close all other open sequence diagrams because Rhapsody Animation will attempt to animate every open sequence diagram. 4. Click Save, Generate, Make, and Run. The animation toolbar should appear. 5. Click Go or press F4. Open the animated statechart of CashRegister if it is not open. Confirm that it is in the idle state. 6. Select Tools > Animated Sequence diagram if it is not already open. When you are prompted to Open Sequence diagram select Behavior. 7. Generate an event by selecting the Generate event icon. 8. Select the object TesterBuilder[0]->itsCashRegister: Lab 12-2 Copyright IBM Corp. 2012

221 Lab 12 Use case 2 animation 9. Select the evstart event to inject first. Copyright IBM Corp Lab 12-3

222 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 10. Inject the following events in the following order after evstart: i. evbarcode(12345) ii. evbarcode(12346) iii. evcancel iv. evend Lab 12-4 Copyright IBM Corp. 2012

223 Lab 12 Use case 2 animation Copyright IBM Corp Lab 12-5

224 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Lab 12-6 Copyright IBM Corp. 2012

225 Lab 12 Use case 2 animation 11. Click Stop to stop the animation. The resulting sequence diagram looks correct, except that you do not see any show operations going to the Tester. That is because the hw port of the Tester is not behavioural. Observe that the Rational Rhapsody implementation of ports is safe. You can safely call the OUT_PORT macro even if there is nothing connected to the port. Recall that there was a warning about this during the code generation. Task 2: Add behavior You have to add some behavior to the Tester class so that it does something when the show operation is invoked via the port. In Rational Rhapsody, the Behavior attribute on a port implies that messages (operations or events) specified in the contract of the port are implemented (or handled) by the instance containing the behavior port. Counter to the notation of behavior is the concept of delegation where messages will be forwarded to, and managed by, other ports. 1. Open the Features of the hw port of the Tester class and check Behavior. Copyright IBM Corp Lab 12-7

226 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 2. When you are prompted to add the realizations click Yes. 3. Add an implementation to the show() operation in Tester. std::cout << "Display : " << amsg << std::endl; Lab 12-8 Copyright IBM Corp. 2012

227 Lab 12 Use case 2 animation Because you used cout in the implementation, you must include <iostream> into the Tester class. 4. In the Tester Overview diagram drag the iostream class from the <<External>> CppLibrary category onto the diagram and add a «Usage» (stereotype) dependency from Tester to the iostream class. Copyright IBM Corp Lab 12-9

228 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 5. Click Save, Generate, Make, and Run. 6. Click Go. Start a new animated Behavior diagram. 7. Reinject the same events as before: i. evstart Lab Copyright IBM Corp. 2012

229 Lab 12 Use case 2 animation ii. evbarcode(12345) iii. evbarcode(12346) iv. evbarcode(12347) v. evbarcode(12348) vi. evbarcode(12349) vii. evcancel viii. evend 8. Depending how many times you entered evbarcode you should see something like this: Copyright IBM Corp Lab 12-11

230 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Lab Copyright IBM Corp. 2012

231 Lab 12 Use case 2 animation Copyright IBM Corp Lab 12-13

232 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 9. Stop the animation. You can check that the model is correct by manually injecting events and observing the animated diagrams. You can Lab Copyright IBM Corp. 2012

233 Lab 12 Use case 2 animation automate these tests by using the Rational Test Conductor. This is an add-on product to Rational Rhapsody that will be discussed later in the course. Another way to automate these tests is to use an actor or another class to drive the model. Task 3: Create statechart of Tester Use the class Tester to execute several scenarios. In order to send messages from the Tester to the CashRegister, you add the event receptions evstart, evend, and evcancel to the IKeyboard interface class. 1. Copy the evcancel, evend, and evstart operations from CashRegister by pressing Ctrl and dragging them to the IKeyboard Interface. 2. Create a Statechart of Tester by right-clicking the Tester class and selecting Add new>statechart. 3. Add a state idle and a default transition to the state. 4. Add two states: scenarioaddingproducts, scenariocancellingproducts. 5. Draw one transition from idle to scenarioaddingproducts and name it evs1, and draw a second transition from idle to scenariocancellingproducts and name it evs2. Copyright IBM Corp Lab 12-15

234 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 4: Add a substatechart for scenarioaddingproducts 1. Add a substatechart for the scenarioaddingproducts state. a. Right-click the scenarioaddingproducts state in the statechart and select Create Substatechart. The following image is the diagram that you are going to draw. Lab Copyright IBM Corp. 2012

235 Lab 12 Use case 2 animation b. Add a send action, and add a default transition to the send action. c. Open the Features of the send action you just drew. In the Event field select evstart from the drop-down list. In the Target field select hw. Copyright IBM Corp Lab 12-17

236 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook d. Add a send action and open Features. In the Event field select evbarcode from the drop-down list. In the Target field select hw. The acode argument is displayed automatically. Enter a value of for acode. Lab Copyright IBM Corp. 2012

237 Lab 12 Use case 2 animation e. Draw a transition from the evstart entry action to the evbarcode entry action and immediately type tm(100). f. Add a send action and open Features. In the Event field select evend from the drop-down list. In the Target field select hw. g. Draw a transition from the evbarcode send action to the evend send action. Immediately type tm(100). h. Draw an Enter/Exit point at the very edge of the substate and name it S1_Done. i. Add a transition from the evend send action to the Enter/Exit point. Copyright IBM Corp Lab 12-19

238 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 5: Add a substatechart for scenariocancellingproducts 1. Right-click the scenariocancellingproducts action in the Tester statechart and select Create Substatechart. The following image is the diagram that you are going to draw: Lab Copyright IBM Corp. 2012

239 Lab 12 Use case 2 animation a. Add a send action and open Features. In the Event field select evstart from the drop-down list. In the Target field select hw. b. Add a send action and open Features. In the Event field select evbarcode from the drop-down list. In the Target field select hw. c. Draw a transition from the evstart entry action to the evbarcode entry action and type tm(100). d. Add a send action and open Features. In the Event field select evcancel from the drop-down list. In the Target field select hw. e. Draw a transition from the evbarcode entry action to the evcancel entry action and type tm(100). f. Repeat step d. g. Draw a transition from the evcancel entry action to the evcancel entry action and type tm(100). h. At the bottom of the diagram add the substate Enter/Exit point and name it S2_DONE. i. Draw a transition from the evcancel entry action to the Enter/exit point. Copyright IBM Corp Lab 12-21

240 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 6: Update substates 1. In the StatechartofTester right-click the scenariocancellingproducts and select Update Enter/Exit Points. 2. Repeat the step 1for the scenarioaddingproducts. 3. Connect the substatechart stub connectors to the idle state with a transition. Task 7: Make the hw port for CashRegister behavioral The CashRegister now needs to do something with the messages that it receives over the port hw. 1. Double-click the Features for the hw port of the Cash Register class. Select the Behavior check box. Click Yes to add the realizations to the CashRegister class. Lab Copyright IBM Corp. 2012

241 Lab 12 Use case 2 animation Task 8: Execute the model 1. Save, Generate, Make and Run the model. 2. Click Go. 3. Open an animated StatechartofTester by selecting Tools > Animated Statechart. When you are prompted to choose the instance select TestBuilder(0)->itsTester. Copyright IBM Corp Lab 12-23

242 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 4. Open an animated sequence diagram by selecting Tools>Animated sequence diagram based on Behavior 5. Generate evs1 event to the Tester object. Lab Copyright IBM Corp. 2012

243 Lab 12 Use case 2 animation Copyright IBM Corp Lab 12-25

244 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 6. Confirm that you see the simulation and the animated sequence diagram. 7. Stop the animation and save the model. Task 9: Property for timeouts In the previous animated sequence diagram the timeouts are cluttering the diagram. There is a property that determines whether or not timeout arrows are displayed in an animated sequence diagram. 1. For the Behavior sequence diagram, in Features>Properties, view all properties by selecting View all in the upper left corner, clear the ShowAnimTimeoutArrow property. 2. Rerun the previous scenario injecting the evs1 event into the Tester object on the animated Behavior sequence diagram. Lab Copyright IBM Corp. 2012

245 Lab 12 Use case 2 animation 3. Confirm that you no longer see the timeout (tm) in the animated sequence diagram. 4. Stop the animation. Save the model. Copyright IBM Corp Lab 12-27

246 Lab 13: Implementing keyboard behavior and multiple threads Objectives After completing this lab, you will be able to: Animate the model with another sequence diagram. Build and run the model to validate it. Enter keys manually at the DOS console. Given In addition to scanning a barcode, another way to enter the barcodes is manually with a keyreader. Sometimes the automated scanner doesn t work and you must add the barcode on the CashRegister keyboard manually. Task 1: Create a new sequence diagram 1. Create a new analysis sequence diagram and name it Scenario manually entering a barcode. 2. Drag the Tester and Cash Register classes onto the new sequence diagram. 3. Add a condition mark and name it idle on the CashRegister lifeline. 4. Add an evstart() event from Tester to CashRegister. Copyright IBM Corp Lab 13-1

247 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 5. Draw a reflexive startsession message on the CashRegister lifeline. 6. Draw an evkey(n) event from Tester to CashRegister Draw a total of 5 evkey(n) events from Tester to CashRegister.. 7. Draw an evcode() event from Tester to CashRegister. 8. Draw an identifyproduct(acode) message from the CashRegister lifeline back to itself. 9. Realize the unrealized messages by going to Edit > Select Unrealized messages. 10. Go to Edit > AutoRealize. This should add two more event receptions evcode and evkey() to the Cash Register class. Lab 13-2 Copyright IBM Corp. 2012

248 Lab 13 more animation 11. Add an argument n of type int to the evkey event by using the Features for the event. Copyright IBM Corp Lab 13-3

249 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 12. Add the two event receptions evcode and evkey(n) to the IKeyboard interface. a. Right-click the IKeyboard interface category and select Add New > Reception. b. Select the event from the drop-down list. Task 2: Managing keys Add a new attribute to the CashRegister class so that you can record the key presses. 1. Open the Features of the CashRegister class and open the Attributes tab. 2. Add an attribute called code of type int that is initialized to zero. Lab 13-4 Copyright IBM Corp. 2012

250 Lab 13 more animation Task 3: Modify the CashRegister statechart In this task you modify the CashRegister statechart to add the events evcode and evkey. 1. Open the CashRegister statechart. 2. On the active state, add a transition to itself. In the Features > Trigger field of the transition, use the dropdown list and select the evcode event. 3. In the Action field of the Features type identifyproduct(code); and on the next line type code=0; Copyright IBM Corp Lab 13-5

251 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 4. Add another transition to itself on the active state. In the Features > Trigger field of the transition, use the drop-down list and select the evkey event. 5. In the Action field of the Features type code=(code*10)+params->n; Note In the picture above the evstart and evend labels were moved on the diagram inadvertently. The direction of Lab 13-6 Copyright IBM Corp. 2012

252 Lab 13 more animation the transitions and events is correct but the labels were moved. 6. Add an action on the code=0; exit to the idle state. Change the display options if necessary so that you can see the action on exit. You have to get the Tester class to wait for key presses, but it is already waiting for events. To do this, you add a KeyReader class that waits for keys. Copyright IBM Corp Lab 13-7

253 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 4: Add a KeyReader class 1. Open the Tester overview object model diagram. 2. Add a KeyReader class that waits for keys. 3. Add a composition from Tester to KeyReader. 4. Add a dependency from KeyReader to iostream stereotyped «Usage» as shown: Because the KeyReader class calls cin, it blocks, and therefore, is an ideal candidate for running on its own thread. 5. Open the Features > General tab of the keyreader and set the concurrency of the KeyReader class to active. Lab 13-8 Copyright IBM Corp. 2012

254 Lab 13 more animation Alternatively, you can set the stereotype to «Active», which adds tags to the class so that you can specify the periodicity and worst case execution time. 6. Click Active Code View and confirm that the KeyReader class inherits from OMThread; this is another Rational Rhapsody framework class. Task 5: Create a thread Rational Rhapsody creates a thread that runs an operation in OMThread called execute(). You must overload this operation so that it constantly reads the keys. 1. Add an execute operation to the KeyReader class that returns OMReactive*. Clear the Use existing type check box and type OMReactive*. Copyright IBM Corp Lab 13-9

255 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 2. Add an implementation to the execute operation: 3. Add a public operation parse to the KeyReader class with the argument name of c and type char. Lab Copyright IBM Corp. 2012

256 Lab 13 more animation 4. Add an implementation: itstester->parse(c); You might be wondering why this was not called from within the execute operation. That was possible, but it was done this way so that you have at least one operation in the KeyReader class that is animated. This allows you to set a breakpoint on the KeyReader thread later on. 5. Add a parse(char c) operation to the Tester class and cut and paste the implementation from the CheatSheet_UC2.txt file: Copyright IBM Corp Lab 13-11

257 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Note: (c 0 ) converts an ASCII character between 0 and 9 to an integer between 0 and 9. Task 6: Switching off animation Because the execute operation never ends, it does not make sense to animate it. 1. Open the properties of the execute operation for the KeyReader class. Lab Copyright IBM Corp. 2012

258 Lab 13 more animation 2. Clear the Animate check box to disable the execute operation from being animated. 3. Check the active code view for the KeyReader.cpp and note that there is now no NOTIFY macro. Task 7: Add a constructor To start the KeyReader thread, you must call the startdispatching operation, which is an inherited operation from Copyright IBM Corp Lab 13-13

259 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook OMThread. You can add a constructor to the Tester class to do this. 1. Right-click the Tester class and select Add New > Constructor. Add the implementation to the Tester constructor: itskeyreader.startdispatching(); 2. Set the ActiveThreadName property for the KeyReader class to KeyReader. Note: If you want to execute the model on a real target, you can set various properties for the thread of the Tester class, for example, the priority, name, stack size, message queue size, and so on. Task 8: Use Rhapsody properties to influence how threads are created You can use the Rhapsody OXF Framework to build your application by creating the threads of execution. In this Lab Copyright IBM Corp. 2012

260 Lab 13 more animation application, you need two threads, one for the cash register execution and one for the keyboard inputs. Use Rhapsody's properties to influence how your application creates the threads. You set two properties that affect the Rhapsody OXF framework. The first is CG::Configuration::StartFrameworkInMainThread. This property specifies that the event dispatch queue starts in a separate thread. The second property, CG::PostFrameworkThreadSegment, sets the code that executes in main() after creating and initializing the threads. 1. Open the Features for the Debug configuration and click the Properties tab. 2. Find the PostFrameworkThreadSegment property and change it to while(1)sleep(10): 3. Clear the StartFrameworkInMainThread check box. Task 9: Execute the model 1. Save the model. Generate, Make, and Run. 2. Click Go or press F4. 3. In the DOS console window enter: s <enter> Copyright IBM Corp Lab 13-15

261 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 12345b <enter> 12347b <enter> c <enter> e <enter> You can now use the keyboard to run scenarios. 4. Confirm the model works and shows that it added the lychees, added pears, and so on. Task 10: Threads 1. Use the Thread icon to examine the threads. To do this, you must first click Pause to pause the animation. 2. You can set the focus of the call stack and event queue to any one thread. Set the focus to the KeyReader thread. Click Set Focus as shown in the previous screenshot. Lab Copyright IBM Corp. 2012

262 Lab 13 more animation 3. Use the breakpoint command to set a breakpoint when the KeyReader thread gets control. 4. Enable the breakpoint. Copyright IBM Corp Lab 13-17

263 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 5. Click Go, and then in the DOS console window enter the following command: s <enter> Lab Copyright IBM Corp. 2012

264 Lab 13 more animation Task 11: Create referenced sequence diagrams 1. In the AnalysisPkg > Use Cases folder, right-click the Keep count of selected products use case and select Add New > Diagrams > Referenced Sequence diagram. 2. Select the Scenario cancelling products in CashRegisterPkg sequence diagram from the list. 3. Select the Keep count of selected products use case on the use case diagram. Right-click the use case and confirm that you see the Reference Sequence Diagram > Scenario cancelling products. Copyright IBM Corp Lab 13-19

265 Lab 14: Reverse engineering external code into a Rational Rhapsody project Objectives After completing this lab, you will be able to: Work with external code in a Rhapsody project. Reverse engineer existing external code and use it in a Rhapsody project. Scenario To reverse engineer code means that you can use code that your company has previously written and bring it into a Rhapsody model. Your company has a library of external C code that runs the cash register printers. Rather than recreating this code in Rhapsody, you can pull the existing code into your model and use what you need. Copyright IBM Corp Lab 14-1

266 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 1: Reverse engineer code into the model In this task, you reverse engineer a.h file into a file element so that you can reference the file on a diagram. Before you start, confirm that you see the checkout_print.h file in the point_of_sale folder directly under the work folder. 1. Load the finished model at the completion of UC3 Generating a ticket showing total cost. The name of the model to load is MyCashRegisterendUC3.rpy. 2. Reverse engineer the C code into your new component: a. Select Tools > Reverse Engineering. b. You see a message box asking you to create a new component. Click Yes. 3. Select the files and settings for reverse engineering: a. In the Reverse Engineering dialog, point to the C:\work\point_of_sale directory as the root Directory. b. For Select Files select Sources. c. Select checkout_print.h. d. For Options select Visualization Only. e. Change the environment to Cygwin. f. Clear Populate Diagrams. Lab 14-2 Copyright IBM Corp. 2012

267 Lab 14 Reverse Engineering 4. Click the Advanced > Mapping tab. You import the file element so that you can reference the file on a diagram. a. Select file as the Modeling Policy. Click OK. Copyright IBM Corp Lab 14-3

268 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 5. Click Start to start the Reverse Engineering. Click Yes when asked if you would like to continue. Be patient while it works because it can take a few minutes. 6. Confirm that you see the following Log output: 7. Confirm that you see the point_of_sale category in the browser with the Files category and the checkout_print file. Lab 14-4 Copyright IBM Corp. 2012

269 Lab 14 Reverse Engineering Task 2: Convert the model to new color scheme When you open a model that was created in an older version of Rhapsody, you can convert it to the version 7.6 color scheme. 1. Select the MyCashRegisterendUC3 project and from the main menu select Edit > Convert to new color scheme. Confirm there is a change in the overall look and feel of the diagram. Task 3: Add the reverse engineered file to the Tester Overview diagram 1. Change the name of the new component that was created when you reverse engineered the code to ExternalCode. 2. Confirm you still have the point_of_sale category in the model. 3. Open the Tester Overview Object Model diagram in the TesterPkg. 4. Drag the checkout_print file in the Files category from the browser onto the diagram. Copyright IBM Corp Lab 14-5

270 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook 5. Draw a dependency from the Tester class to the checkout_print file. 6. Add the <<Usage>> stereotype on the dependency to the external class. Task 4: Confirm and edit component settings 1. Confirm that the active component is set to TesterPrototype. 2. Confirm the TesterPrototype Features > Scope settings match the following image: Lab 14-6 Copyright IBM Corp. 2012

271 Lab 14 Reverse Engineering 3. In the Features > General tab for TesterPrototype, for the Include_Path field type C:/work/point_of_sale. 4. For the Libraries field type C:/work/point_of_sale/PointOfSaleLibrary.a Copyright IBM Corp Lab 14-7

272 Essentials of IBM Rational Rhapsody v7.6 for Software Engineers Student Workbook Task 5: Edit the print operation in Tester 1. Open the print char* amsg operation in the Tester class. 2. Change the implementation to terminal_print (amsg); Lab 14-8 Copyright IBM Corp. 2012

273 Lab 14 Reverse Engineering 3. Generate, Make, Run the model. 4. Click Go. 5. Start an animated Behavior sequence diagram. Use the TesterBuilder->itsTester object instance. 6. Inject the evs3 event to the animated sequence diagram. Confirm you see the simulation output: 7. Stop the animation. Close the animated Behavior diagram. Copyright IBM Corp Lab 14-9

274 Lab 15: Use Case 4: Manage Special Offers Objectives After completing this lab, you will be able to: Use the Cash Register model to handle special offers Scenario There are a number of special offers available in the store. This lab will set up the cash register to handle the special offers. Copyright IBM Corp Lab 15-1

275 Essentials of IBM Rational Rhapsody v7.6 for software engineers Student Workbook Task 1: Modify the Object Model diagram Use the completed model from Lab 14 to modify it to handle special offers. 1. Open the Product Overview Object Model Diagram and add an interface named ISpecialOffer. a. Add an aggregation from Product to ISpecialOffer. 2. Change the relation to be directional and not symmetrical by changing the Consists of field in the Features. The role name will become ItsISpecialOffer when you do this. Lab 15-2 Copyright IBM Corp. 2012

276 Lab 15 Manage Special Offers a. Set Multiplicity to 0,1. 3. To the ISpecialOffer interface add an operation getspecialprice() which returns int. Copyright IBM Corp Lab 15-3

277 Essentials of IBM Rational Rhapsody v7.6 for software engineers Student Workbook 4. Add arguments unitprice and quantity both of type int to the getspecialprice operation. 5. In the CashRegisterPkg add a new OMD named Special Offers Overview. This shows you the various different special offers available. Draw the diagram as it is depicted below you can also use the steps below. Use the Realization icon in diagram tools to draw the realizations to ISpecialOffer. Lab 15-4 Copyright IBM Corp. 2012

278 Lab 15 Manage Special Offers a. Drag the ISpecialOffer interface onto the Object Model diagram. b. Add three new classes to the diagram: BuyOneGetOneFree, TenPercentOff, ThreeForOneEuro. c. Draw a realization from each class to the ISpecialOffer interface. 6. Select the BuyOneGetOneFree class, right-click and select Realize Base Class. 7. Implement the getspecialprice() operation by following the next step: a. Check the operation and select Edit Code to enter the implementation: return (unitprice * ((quantity+1)/2)); Copyright IBM Corp Lab 15-5

279 Essentials of IBM Rational Rhapsody v7.6 for software engineers Student Workbook 8. Implement the getspecialprice() operation for the other classes that realize ISpecialOffer: 9. Select the ThreeForOneEuro class, right-click and select Realize Base Class. Implement the getspecialprice() operation and enter the implementation: return ((quantity+2) / 3); 10. Select the TenPercentOff class, right-click and select Realize Base Class. Implement the getspecialprice() operation and enter the implementation: return (unitprice * quantity * 90) / 100; 11. Modify the Product Database Overview OMD. a. Drag the BuyOneGetOneFree class onto the diagram and add a dependency from ProductDatabase to it. b. Open the features for this dependency and set the stereotype to <<Usage>>. (The <<Usage>> stereotype generates a #include BuyOneGetOneFree.h.) Lab 15-6 Copyright IBM Corp. 2012

280 Lab 15 Manage Special Offers 12. Modify the implementation of the ProductDatabase constuctor. a. Add the following line to the beginning of the constuctor: ISpecialOffer* todaysoffer = new BuyOneGetOneFree; b. Change the entry for Kiwis: additsproduce ( 12346, new Product ( 12346, Kiwis, 120, todaysoffer)); 13. Modify the Product constructors. a. In Product(int abarcode, char* aname, int aunitprice) make the following changes: Add an argument named aspecialoffer of type ISpecialOffer, initial value NULL Copyright IBM Corp Lab 15-7

Essentials of IBM Rational Rhapsody v7.5 for Software Engineers (C++)

Essentials of IBM Rational Rhapsody v7.5 for Software Engineers (C++) IBM Software Group Essentials of IBM Rational Rhapsody v7.5 for Software Engineers (C++) Basic Rational Rhapsody IBM Corporation Exercise 1 : Hello World 2 Start Rhapsody in C++ Double click RhapsodyInC++

More information

MODEL-BASED DEVELOPMENT -TUTORIAL

MODEL-BASED DEVELOPMENT -TUTORIAL MODEL-BASED DEVELOPMENT -TUTORIAL 1 Objectives To get familiar with the fundamentals of Rational Rhapsody. You start with the simplest example possible. You end with more complex functionality, and a more

More information

Release Notes. IBM Tivoli Identity Manager Universal Provisioning Adapter. Version First Edition (June 14, 2010)

Release Notes. IBM Tivoli Identity Manager Universal Provisioning Adapter. Version First Edition (June 14, 2010) IBM Tivoli Identity Manager Version 5.1.2 First Edition (June 14, 2010) This edition applies to version 5.1 of Tivoli Identity Manager and to all subsequent releases and modifications until otherwise indicated

More information

Release Notes. IBM Tivoli Identity Manager Rational ClearQuest Adapter for TDI 7.0. Version First Edition (January 15, 2011)

Release Notes. IBM Tivoli Identity Manager Rational ClearQuest Adapter for TDI 7.0. Version First Edition (January 15, 2011) IBM Tivoli Identity Manager for TDI 7.0 Version 5.1.1 First Edition (January 15, 2011) This edition applies to version 5.1 of Tivoli Identity Manager and to all subsequent releases and modifications until

More information

Release Notes. IBM Security Identity Manager GroupWise Adapter. Version First Edition (September 13, 2013)

Release Notes. IBM Security Identity Manager GroupWise Adapter. Version First Edition (September 13, 2013) Release Notes IBM Security Identity Manager GroupWise Adapter Version 6.0.2 First Edition (September 13, 2013) This edition applies to version 6.0 of IBM Security Identity Manager and to all subsequent

More information

Platform LSF Version 9 Release 1.1. Migrating on Windows SC

Platform LSF Version 9 Release 1.1. Migrating on Windows SC Platform LSF Version 9 Release 1.1 Migrating on Windows SC27-5317-00 Platform LSF Version 9 Release 1.1 Migrating on Windows SC27-5317-00 Note Before using this information and the product it supports,

More information

Platform LSF Version 9 Release 1.3. Migrating on Windows SC

Platform LSF Version 9 Release 1.3. Migrating on Windows SC Platform LSF Version 9 Release 1.3 Migrating on Windows SC27-5317-03 Platform LSF Version 9 Release 1.3 Migrating on Windows SC27-5317-03 Note Before using this information and the product it supports,

More information

IBM i Version 7.2. Systems management Logical partitions IBM

IBM i Version 7.2. Systems management Logical partitions IBM IBM i Version 7.2 Systems management Logical partitions IBM IBM i Version 7.2 Systems management Logical partitions IBM Note Before using this information and the product it supports, read the information

More information

IBM Endpoint Manager Version 9.1. Patch Management for Ubuntu User's Guide

IBM Endpoint Manager Version 9.1. Patch Management for Ubuntu User's Guide IBM Endpoint Manager Version 9.1 Patch Management for Ubuntu User's Guide IBM Endpoint Manager Version 9.1 Patch Management for Ubuntu User's Guide Note Before using this information and the product it

More information

Release Notes. IBM Tivoli Identity Manager GroupWise Adapter. Version First Edition (September 13, 2013)

Release Notes. IBM Tivoli Identity Manager GroupWise Adapter. Version First Edition (September 13, 2013) Release Notes IBM Tivoli Identity Manager GroupWise Adapter Version 5.1.5 First Edition (September 13, 2013) This edition applies to version 5.1 of Tivoli Identity Manager and to all subsequent releases

More information

Build integration overview: Rational Team Concert and IBM UrbanCode Deploy

Build integration overview: Rational Team Concert and IBM UrbanCode Deploy Highlights Overview topology of the main build-related interactions between the IBM UrbanCode Deploy and Rational Team Concert servers. Overview of two common build and deployment processes for mainframe

More information

IBM OpenPages GRC Platform Version 7.0 FP2. Enhancements

IBM OpenPages GRC Platform Version 7.0 FP2. Enhancements IBM OpenPages GRC Platform Version 7.0 FP2 Enhancements NOTE Before using this information and the product it supports, read the information in the Notices section of this document. Product Information

More information

IBM Cloud Orchestrator. Content Pack for IBM Endpoint Manager for Software Distribution IBM

IBM Cloud Orchestrator. Content Pack for IBM Endpoint Manager for Software Distribution IBM IBM Cloud Orchestrator Content Pack for IBM Endpoint Manager for Software Distribution IBM IBM Cloud Orchestrator Content Pack for IBM Endpoint Manager for Software Distribution IBM Note Before using

More information

IBM. Networking Open Shortest Path First (OSPF) support. IBM i. Version 7.2

IBM. Networking Open Shortest Path First (OSPF) support. IBM i. Version 7.2 IBM IBM i Networking Open Shortest Path First (OSPF) support Version 7.2 IBM IBM i Networking Open Shortest Path First (OSPF) support Version 7.2 Note Before using this information and the product it

More information

CONFIGURING SSO FOR FILENET P8 DOCUMENTS

CONFIGURING SSO FOR FILENET P8 DOCUMENTS CONFIGURING SSO FOR FILENET P8 DOCUMENTS Overview Configuring IBM Content Analytics with Enterprise Search (ICA) to support single sign-on (SSO) authentication for secure search of IBM FileNet P8 (P8)

More information

IBM. Business Process Troubleshooting. IBM Sterling B2B Integrator. Release 5.2

IBM. Business Process Troubleshooting. IBM Sterling B2B Integrator. Release 5.2 IBM Sterling B2B Integrator IBM Business Process Troubleshooting Release 5.2 IBM Sterling B2B Integrator IBM Business Process Troubleshooting Release 5.2 Note Before using this information and the product

More information

Using application properties in IBM Cúram Social Program Management JUnit tests

Using application properties in IBM Cúram Social Program Management JUnit tests Using application properties in IBM Cúram Social Program Management JUnit tests Erika Grine (Erika.Grine@ie.ibm.com) 8 June 2015 Senior Software Engineer, IBM Cúram Social Program Management group IBM

More information

IBM Kenexa LCMS Premier on Cloud. Release Notes. Version 9.3

IBM Kenexa LCMS Premier on Cloud. Release Notes. Version 9.3 IBM Kenexa LCMS Premier on Cloud Release Notes Version 9.3 IBM Kenexa LCMS Premier on Cloud Release Notes Version 9.3 Note Before using this information and the product it supports, read the information

More information

Version 9 Release 0. IBM i2 Analyst's Notebook Configuration IBM

Version 9 Release 0. IBM i2 Analyst's Notebook Configuration IBM Version 9 Release 0 IBM i2 Analyst's Notebook Configuration IBM Note Before using this information and the product it supports, read the information in Notices on page 11. This edition applies to version

More information

IBM Spectrum LSF Process Manager Version 10 Release 1. Release Notes IBM GI

IBM Spectrum LSF Process Manager Version 10 Release 1. Release Notes IBM GI IBM Spectrum LSF Process Manager Version 10 Release 1 Release Notes IBM GI13-1891-04 IBM Spectrum LSF Process Manager Version 10 Release 1 Release Notes IBM GI13-1891-04 Note Before using this information

More information

Requirements Supplement

Requirements Supplement Sterling Selling and Fulfillment Suite Requirements Supplement Release 9.2 Sterling Selling and Fulfillment Suite Requirements Supplement Release 9.2 Note Before using this information and the product

More information

Version 9 Release 0. IBM i2 Analyst's Notebook Premium Configuration IBM

Version 9 Release 0. IBM i2 Analyst's Notebook Premium Configuration IBM Version 9 Release 0 IBM i2 Analyst's Notebook Premium Configuration IBM Note Before using this information and the product it supports, read the information in Notices on page 11. This edition applies

More information

IBM. Networking INETD. IBM i. Version 7.2

IBM. Networking INETD. IBM i. Version 7.2 IBM IBM i Networking INETD Version 7.2 IBM IBM i Networking INETD Version 7.2 Note Before using this information and the product it supports, read the information in Notices on page 5. This document may

More information

IBM Security QRadar Version Forwarding Logs Using Tail2Syslog Technical Note

IBM Security QRadar Version Forwarding Logs Using Tail2Syslog Technical Note IBM Security QRadar Version 7.2.0 Forwarding Logs Using Tail2Syslog Technical Note Note: Before using this information and the product that it supports, read the information in Notices and Trademarks on

More information

IBM Cognos Dynamic Query Analyzer Version Installation and Configuration Guide IBM

IBM Cognos Dynamic Query Analyzer Version Installation and Configuration Guide IBM IBM Cognos Dynamic Query Analyzer Version 11.0.0 Installation and Configuration Guide IBM Note Before using this information and the product it supports, read the information in Notices on page 7. Product

More information

IBM i Version 7.2. Connecting to your system Connecting to IBM Navigator for i IBM

IBM i Version 7.2. Connecting to your system Connecting to IBM Navigator for i IBM IBM i Version 7.2 Connecting to your system Connecting to IBM Navigator for i IBM IBM i Version 7.2 Connecting to your system Connecting to IBM Navigator for i IBM Note Before using this information and

More information

IBM WebSphere Sample Adapter for Enterprise Information System Simulator Deployment and Testing on WPS 7.0. Quick Start Scenarios

IBM WebSphere Sample Adapter for Enterprise Information System Simulator Deployment and Testing on WPS 7.0. Quick Start Scenarios IBM WebSphere Sample Adapter for Enterprise Information System Simulator 7.0.0.0 Deployment and Testing on WPS 7.0 Quick Start Scenarios Note: Before using this information and the product it supports,

More information

Tivoli Access Manager for Enterprise Single Sign-On

Tivoli Access Manager for Enterprise Single Sign-On Tivoli Access Manager for Enterprise Single Sign-On Version 6.0 Kiosk Adapter User's Guide SC23-6342-00 Tivoli Access Manager for Enterprise Single Sign-On Version 6.0 Kiosk Adapter User's Guide SC23-6342-00

More information

Integrating IBM Rational Build Forge with IBM Rational ClearCase and IBM Rational ClearQuest

Integrating IBM Rational Build Forge with IBM Rational ClearCase and IBM Rational ClearQuest with IBM Rational ClearCase and IBM Rational ClearQuest Setup requirements and adaptor templates John H. Gough July 13, 2011 Page 1 of 21 Note Before using this information and the product it supports,

More information

IBM. Avoiding Inventory Synchronization Issues With UBA Technical Note

IBM. Avoiding Inventory Synchronization Issues With UBA Technical Note IBM Tivoli Netcool Performance Manager 1.4.3 Wireline Component Document Revision R2E1 Avoiding Inventory Synchronization Issues With UBA Technical Note IBM Note Before using this information and the product

More information

Tivoli Access Manager for Enterprise Single Sign-On

Tivoli Access Manager for Enterprise Single Sign-On Tivoli Access Manager for Enterprise Single Sign-On Version 5.0 Kiosk Adapter Release Notes Tivoli Access Manager for Enterprise Single Sign-On Version 5.0 Kiosk Adapter Release Notes Note: Before using

More information

IBM Content Analytics with Enterprise Search Version 3.0. Expanding queries and influencing how documents are ranked in the results

IBM Content Analytics with Enterprise Search Version 3.0. Expanding queries and influencing how documents are ranked in the results IBM Content Analytics with Enterprise Search Version 3.0 Expanding queries and influencing how documents are ranked in the results IBM Content Analytics with Enterprise Search Version 3.0 Expanding queries

More information

IBM Extended Command-Line Interface (XCLI) Utility Version 5.2. Release Notes IBM

IBM Extended Command-Line Interface (XCLI) Utility Version 5.2. Release Notes IBM IBM Extended Command-Line Interface (XCLI) Utility Version 5.2 Release Notes IBM Fifth Edition (November 2018) This edition applies to the IBM XCLI Utility version 5.2 software. Newer document editions

More information

IBM Operations Analytics - Log Analysis: Network Manager Insight Pack Version 1 Release 4.1 GI IBM

IBM Operations Analytics - Log Analysis: Network Manager Insight Pack Version 1 Release 4.1 GI IBM IBM Operations Analytics - Log Analysis: Network Manager Insight Pack Version 1 Release 4.1 GI13-4702-05 IBM Note Before using this information and the product it supports, read the information in Notices

More information

Getting Started with InfoSphere Streams Quick Start Edition (VMware)

Getting Started with InfoSphere Streams Quick Start Edition (VMware) IBM InfoSphere Streams Version 3.2 Getting Started with InfoSphere Streams Quick Start Edition (VMware) SC19-4180-00 IBM InfoSphere Streams Version 3.2 Getting Started with InfoSphere Streams Quick Start

More information

IBM. IBM i2 Enterprise Insight Analysis Understanding the Deployment Patterns. Version 2 Release 1 BA

IBM. IBM i2 Enterprise Insight Analysis Understanding the Deployment Patterns. Version 2 Release 1 BA IBM i2 Enterprise Insight Analysis Understanding the Deployment Patterns Version 2 Release 1 IBM BA21-8475-00 Note Before using this information and the product it supports, read the information in Notices

More information

IBM Netcool/OMNIbus 8.1 Web GUI Event List: sending NodeClickedOn data using Netcool/Impact. Licensed Materials Property of IBM

IBM Netcool/OMNIbus 8.1 Web GUI Event List: sending NodeClickedOn data using Netcool/Impact. Licensed Materials Property of IBM IBM Netcool/OMNIbus 8.1 Web GUI Event List: sending NodeClickedOn data using Netcool/Impact Licensed Materials Property of IBM Note: Before using this information and the product it supports, read the

More information

IBM Operational Decision Manager Version 8 Release 5. Configuring Operational Decision Manager on Java SE

IBM Operational Decision Manager Version 8 Release 5. Configuring Operational Decision Manager on Java SE IBM Operational Decision Manager Version 8 Release 5 Configuring Operational Decision Manager on Java SE Note Before using this information and the product it supports, read the information in Notices

More information

Performance Tuning Guide

Performance Tuning Guide IBM Security Identity Governance and Intelligence Version 5.2.1 Performance Tuning Guide Note: Before using this information and the product it supports, read the information in Notices. 1st Edition notice

More information

IBM Security QRadar Version Customizing the Right-Click Menu Technical Note

IBM Security QRadar Version Customizing the Right-Click Menu Technical Note IBM Security QRadar Version 7.2.0 Technical Note Note: Before using this information and the product that it supports, read the information in Notices and Trademarks on page 3. Copyright IBM Corp. 2012,

More information

IBM Rational Development and Test Environment for System z Version Release Letter GI

IBM Rational Development and Test Environment for System z Version Release Letter GI IBM Rational Development and Test Environment for System z Version 8.5.0.2 Release Letter GI11-9161-05 IBM Rational Development and Test Environment for System z Version 8.5.0.2 Release Letter GI11-9161-05

More information

Version 2 Release 1. IBM i2 Enterprise Insight Analysis Understanding the Deployment Patterns IBM BA

Version 2 Release 1. IBM i2 Enterprise Insight Analysis Understanding the Deployment Patterns IBM BA Version 2 Release 1 IBM i2 Enterprise Insight Analysis Understanding the Deployment Patterns IBM BA21-8475-00 Note Before using this information and the product it supports, read the information in Notices

More information

Development tools System i5 Debugger

Development tools System i5 Debugger System i Development tools System i5 Debugger Version 6 Release 1 System i Development tools System i5 Debugger Version 6 Release 1 Note Before using this information and the product it supports, read

More information

IBM InfoSphere Master Data Management Reference Data Management Hub Version 11 Release 0. Upgrade Guide GI

IBM InfoSphere Master Data Management Reference Data Management Hub Version 11 Release 0. Upgrade Guide GI IBM InfoSphere Master Data Management Reference Data Management Hub Version 11 Release 0 Upgrade Guide GI13-2672-00 IBM InfoSphere Master Data Management Reference Data Management Hub Version 11 Release

More information

Installing Watson Content Analytics 3.5 Fix Pack 1 on WebSphere Application Server Network Deployment 8.5.5

Installing Watson Content Analytics 3.5 Fix Pack 1 on WebSphere Application Server Network Deployment 8.5.5 IBM Software Services, Support and Success IBM Watson Group IBM Watson Installing Watson Content Analytics 3.5 Fix Pack 1 on WebSphere Application Server Network Deployment 8.5.5 This document provides

More information

IBM i2 ibridge 8 for Oracle

IBM i2 ibridge 8 for Oracle IBM i2 ibridge 8 for Oracle Provided with IBM i2 ibridge 8.9 May 2012 Copyright Note: Before using this information and the product it supports, read the information in Notices on page 8. This edition

More information

IBM Tivoli Identity Manager Authentication Manager (ACE) Adapter for Solaris

IBM Tivoli Identity Manager Authentication Manager (ACE) Adapter for Solaris IBM Tivoli Identity Manager Authentication Manager (ACE) Adapter for Solaris Version 5.1.3 First Edition (May 12, 2011) This edition applies to version 5.1 of Tivoli Identity Manager and to all subsequent

More information

Release Notes. IBM Tivoli Identity Manager I5/OS Adapter. Version First Edition (January 9, 2012)

Release Notes. IBM Tivoli Identity Manager I5/OS Adapter. Version First Edition (January 9, 2012) IBM Tivoli Identity Manager I5/OS Adapter Version 5.0.9 First Edition (January 9, 2012) This edition applies to version 5.0 of Tivoli Identity Manager and to all subsequent releases and modifications until

More information

A Quick Look at IBM SmartCloud Monitoring. Author: Larry McWilliams, IBM Tivoli Integration of Competency Document Version 1, Update:

A Quick Look at IBM SmartCloud Monitoring. Author: Larry McWilliams, IBM Tivoli Integration of Competency Document Version 1, Update: A Quick Look at IBM SmartCloud Monitoring Author: Larry McWilliams, IBM Tivoli Integration of Competency Document Version 1, Update: 2012-01-23 Note: Before using this information and the product it supports,

More information

Migrating on UNIX and Linux

Migrating on UNIX and Linux Platform LSF Version 9 Release 1.3 Migrating on UNIX and Linux SC27-5318-03 Platform LSF Version 9 Release 1.3 Migrating on UNIX and Linux SC27-5318-03 Note Before using this information and the product

More information

IBM Rational Synergy DCM-GUI

IBM Rational Synergy DCM-GUI IBM Rational Synergy DCM-GUI Release 7.2.1.1 IBM Rational Synergy - 1 - This edition applies to IBM Rational Synergy version 7.2.1.1, and to all subsequent releases and modifications until otherwise indicated

More information

IBM Maximo Calibration Version 7 Release 5. Installation Guide

IBM Maximo Calibration Version 7 Release 5. Installation Guide IBM Maximo Calibration Version 7 Release 5 Installation Guide Note Before using this information and the product it supports, read the information in Notices on page 7. This edition applies to version

More information

Netcool/Impact Version Release Notes GI

Netcool/Impact Version Release Notes GI Netcool/Impact Version 6.1.0.1 Release Notes GI11-8131-03 Netcool/Impact Version 6.1.0.1 Release Notes GI11-8131-03 Note Before using this information and the product it supports, read the information

More information

IBM Blockchain IBM Blockchain Developing Applications Workshop - Node-Red Integration

IBM Blockchain IBM Blockchain Developing Applications Workshop - Node-Red Integration IBM Blockchain Developing Applications Workshop - Node-Red Integration Exercise Guide Contents INSTALLING COMPOSER NODE-RED NODES... 4 INTEGRATE NODE-RED WITH COMPOSER BUSINESS NETWORK... 7 APPENDIX A.

More information

IBM Storage Management Pack for Microsoft System Center Operations Manager (SCOM) Version Release Notes

IBM Storage Management Pack for Microsoft System Center Operations Manager (SCOM) Version Release Notes IBM Storage Management Pack for Microsoft System Center Operations Manager (SCOM) Version 1.2.0 Release Notes First Edition (September 2012) This edition applies to version 1.2.0 of the IBM Storage Management

More information

IBM emessage Version 8.x and higher. Account Startup Overview

IBM emessage Version 8.x and higher.  Account Startup Overview IBM emessage Version 8.x and higher Email Account Startup Overview Note Before using this information and the product it supports, read the information in Notices on page 3. This edition applies to all

More information

Migrating Classifications with Migration Manager

Migrating Classifications with Migration Manager IBM Maximo Asset Management 7.1 IBM Maximo Asset Management for IT 7.1 IBM Tivoli Change and Configuration Management Database 7.1.1 IBM Tivoli Service Request Manager 7.1 Migrating Classifications with

More information

IBM Algo Financial Modeler Version Foundation/Lite Installation Guide IBM

IBM Algo Financial Modeler Version Foundation/Lite Installation Guide IBM IBM Algo Financial Modeler Version 2.3.0.0 Foundation/Lite Installation Guide IBM Note Before using this information and the product it supports, read the information in Notices on page 17. Product information

More information

IBM LoadLeveler Version 5 Release 1. Documentation Update: IBM LoadLeveler Version 5 Release 1 IBM

IBM LoadLeveler Version 5 Release 1. Documentation Update: IBM LoadLeveler Version 5 Release 1 IBM IBM LoadLeveler Version 5 Release 1 Documentation Update: IBM LoadLeveler Version 5 Release 1 IBM IBM LoadLeveler Version 5 Release 1 Documentation Update: IBM LoadLeveler Version 5 Release 1 IBM ii IBM

More information

Readme File for Fix Pack 1

Readme File for Fix Pack 1 IBM Tivoli Workload Scheduler z/os Connector Readme File for Fix Pack 1 Version 8.5.1 IBM Tivoli Workload Scheduler z/os Connector Readme File for Fix Pack 1 Version 8.5.1 Note Before using this information

More information

Patch Management for Solaris

Patch Management for Solaris Patch Management for Solaris User s Guide User s Guide i Note: Before using this information and the product it supports, read the information in Notices. Copyright IBM Corporation 2003, 2011. US Government

More information

Best practices. Starting and stopping IBM Platform Symphony Developer Edition on a two-host Microsoft Windows cluster. IBM Platform Symphony

Best practices. Starting and stopping IBM Platform Symphony Developer Edition on a two-host Microsoft Windows cluster. IBM Platform Symphony IBM Platform Symphony Best practices Starting and stopping IBM Platform Symphony Developer Edition on a two-host Microsoft Windows cluster AjithShanmuganathan IBM Systems & Technology Group, Software Defined

More information

IBM Rational DOORS Installing and Using the RQM Interface Release 9.2

IBM Rational DOORS Installing and Using the RQM Interface Release 9.2 IBM Rational DOORS Installing and Using the RQM Interface Release 9.2 Before using this information, be sure to read the general information under Appendix, Notices, on page 32. This edition applies to

More information

Application and Database Protection in a VMware vsphere Environment

Application and Database Protection in a VMware vsphere Environment IBM Tivoli Storage Manager Application and Database Protection in a VMware September 5, 2013 1.2 Authors: Jason Basler, Dave Cannon, Jim Smith, Greg Van Hise, Chris Zaremba Page 1 of 13 Note: Before using

More information

IBM OpenPages GRC Platform - Version Interim Fix 1. Interim Fix ReadMe

IBM OpenPages GRC Platform - Version Interim Fix 1. Interim Fix ReadMe IBM OpenPages GRC Platform - Version 7.1.0.4 Interim Fix 1 Interim Fix ReadMe IBM OpenPages GRC Platform 7.1.0.4 Interim Fix 1 ReadMe 2 of 16 NOTE Before using this information and the product it supports,

More information

IBM Storage Driver for OpenStack Version Release Notes

IBM Storage Driver for OpenStack Version Release Notes IBM Storage Driver for OpenStack Version 1.3.1 Release Notes First Edition (April 2014) This edition applies to version 1.3.1 of the IBM Storage Driver for OpenStack software package. Newer editions may

More information

Using Netcool/Impact and IBM Tivoli Monitoring to build a custom selfservice

Using Netcool/Impact and IBM Tivoli Monitoring to build a custom selfservice IBM Tivoli Software Using Netcool/Impact and IBM Tivoli Monitoring to build a custom selfservice dashboard Document version 1.0 Brian R. Fabec IBM Software Developer Copyright International Business Machines

More information

iscsi Configuration Manager Version 2.0

iscsi Configuration Manager Version 2.0 iscsi Configuration Manager Version 2.0 Release notes iscsi Configuration Manager Version 2.0 Release notes Note Before using this information and the product it supports, read the general information

More information

IBM Integration Designer Version 8 Release 5. Hello World for WebSphere DataPower Appliance IBM

IBM Integration Designer Version 8 Release 5. Hello World for WebSphere DataPower Appliance IBM IBM Integration Designer Version 8 Release 5 Hello World for WebSphere DataPower Appliance IBM Note Before using this information and the product it supports, read the information in Notices on page 21.

More information

IBM XIV Host Attachment Kit for HP-UX Version Release Notes

IBM XIV Host Attachment Kit for HP-UX Version Release Notes IBM XIV Host Attachment Kit for HP-UX Version 2.4.0 Release Notes First Edition (March 2015) This document edition applies to version 2.4.0 of the IBM XIV Host Attachment Kit for HP-UX software package.

More information

MAPI Gateway Configuration Guide

MAPI Gateway Configuration Guide IBM Sterling Gentran:Server for Windows MAPI Gateway Configuration Guide Version 5.3.1 IBM Sterling Gentran:Server for Windows MAPI Gateway Configuration Guide Version 5.3.1 Note Before using this information

More information

Tivoli Access Manager for Enterprise Single Sign-On

Tivoli Access Manager for Enterprise Single Sign-On Tivoli Access Manager for Enterprise Single Sign-On Version 6.0 Kiosk Adapter Installation and Setup Guide GC23-6353-00 Tivoli Access Manager for Enterprise Single Sign-On Version 6.0 Kiosk Adapter Installation

More information

Tivoli Endpoint Manager for Patch Management - AIX. User s Guide

Tivoli Endpoint Manager for Patch Management - AIX. User s Guide Tivoli Endpoint Manager for Patch Management - AIX User s Guide User s Guide i Note: Before using this information and the product it supports, read the information in Notices. Copyright IBM Corporation

More information

IBM i2 Analyst s Notebook Quick Start Guide

IBM i2 Analyst s Notebook Quick Start Guide IBM i2 Analyst s Notebook Quick Start Guide Provided with IBM i2 Analyst s Notebook 8.9 May 202 - - Copyright 0. This edition applies to version 8, release 9 of IBM i2 Analyst s Notebook (product number

More information

IBM. IBM i2 Enterprise Insight Analysis User Guide. Version 2 Release 1

IBM. IBM i2 Enterprise Insight Analysis User Guide. Version 2 Release 1 IBM IBM i2 Enterprise Insight Analysis User Guide Version 2 Release 1 Note Before using this information and the product it supports, read the information in Notices on page 19. This edition applies to

More information

Tivoli Access Manager for Enterprise Single Sign-On

Tivoli Access Manager for Enterprise Single Sign-On Tivoli Access Manager for Enterprise Single Sign-On Version 6.0 Web Viewer Installation and Setup Guide SC32-1991-03 Tivoli Access Manager for Enterprise Single Sign-On Version 6.0 Web Viewer Installation

More information

IBM Storage Management Pack for Microsoft System Center Operations Manager (SCOM) Version Release Notes IBM

IBM Storage Management Pack for Microsoft System Center Operations Manager (SCOM) Version Release Notes IBM IBM Storage Management Pack for Microsoft System Center Operations Manager (SCOM) Version 2.5.0 Release Notes IBM First Edition (July 2016) This edition applies to version 2.5.0 of the IBM Storage Management

More information

Determining dependencies in Cúram data

Determining dependencies in Cúram data IBM Cúram Social Program Management Determining dependencies in Cúram data In support of data archiving and purging requirements Document version 1.0 Paddy Fagan, Chief Architect, IBM Cúram Platform Group

More information

Implementing Enhanced LDAP Security

Implementing Enhanced LDAP Security IBM FileNet Image Services Version 4.2 Implementing Enhanced LDAP Security SC19-3304-00 IBM FileNet Image Services Version 4.2 Implementing Enhanced LDAP Security SC19-3304-00 Note Before using this information

More information

Best practices. Reducing concurrent SIM connection requests to SSM for Windows IBM Platform Symphony

Best practices. Reducing concurrent SIM connection requests to SSM for Windows IBM Platform Symphony IBM Platform Symphony Best practices Reducing concurrent SIM connection requests to SSM for Windows 2008 Tao Tong IBM Systems & Technology Group, Software Defined Systems Manager, Platform Symphony QA,

More information

Networking Bootstrap Protocol

Networking Bootstrap Protocol System i Networking Bootstrap Protocol Version 5 Release 4 System i Networking Bootstrap Protocol Version 5 Release 4 Note Before using this information and the product it supports, read the information

More information

Installing on Windows

Installing on Windows Platform LSF Version 9 Release 1.3 Installing on Windows SC27-5316-03 Platform LSF Version 9 Release 1.3 Installing on Windows SC27-5316-03 Note Before using this information and the product it supports,

More information

IBM Storage Driver for OpenStack Version Installation Guide SC

IBM Storage Driver for OpenStack Version Installation Guide SC IBM Storage Driver for OpenStack Version 1.1.0 Installation Guide SC27-4233-00 Note Before using this document and the product it supports, read the information in Notices on page 9. Edition notice Publication

More information

Integrated use of IBM WebSphere Adapter for Siebel and SAP with WPS Relationship Service. Quick Start Scenarios

Integrated use of IBM WebSphere Adapter for Siebel and SAP with WPS Relationship Service. Quick Start Scenarios Integrated use of IBM WebSphere Adapter for Siebel 7.0.0.0 and SAP 7.0.0.0 with WPS Relationship Service Quick Start Scenarios 1 1. Note: Before using this information and the product it supports, read

More information

IBM Security Access Manager for Versions 9.0.2, IBM Security App Exchange Installer for ISAM

IBM Security Access Manager for Versions 9.0.2, IBM Security App Exchange Installer for ISAM IBM Security Access Manager for Versions 9.0.2, 9.0.3 IBM Security App Exchange Installer for ISAM Contents PREFACE... 3 Access to publications and terminology... 3 Publication Library... 3 IBM Terminology

More information

Rational Developer for IBM i (RDI) Distance Learning hands-on Labs IBM Rational Developer for i. Maintain an ILE RPG application using.

Rational Developer for IBM i (RDI) Distance Learning hands-on Labs IBM Rational Developer for i. Maintain an ILE RPG application using. Rational Developer for IBM i (RDI) IBM Software Distance Learning hands-on Labs IBM Rational Developer for i Maintain an ILE RPG application using Remote System Explorer Verify/compile an RPG source member

More information

IBM License Metric Tool Version Readme File for: IBM License Metric Tool, Fix Pack TIV-LMT-FP0001

IBM License Metric Tool Version Readme File for: IBM License Metric Tool, Fix Pack TIV-LMT-FP0001 IBM License Metric Tool Version 7.2.1 Readme File for: IBM License Metric Tool, Fix Pack 7.2.1-TIV-LMT-FP0001 IBM License Metric Tool Version 7.2.1 Readme File for: IBM License Metric Tool, Fix Pack 7.2.1-TIV-LMT-FP0001

More information

IBM SmartCloud for Social Business. Sametime Chat and Meetings mobile User's Guide

IBM SmartCloud for Social Business. Sametime Chat and Meetings mobile User's Guide IBM SmartCloud for Social Business Sametime Chat and Meetings mobile User's Guide IBM SmartCloud for Social Business Sametime Chat and Meetings mobile User's Guide Note Before using this information and

More information

IBM Operational Decision Manager. Version Sample deployment for Operational Decision Manager for z/os artifact migration

IBM Operational Decision Manager. Version Sample deployment for Operational Decision Manager for z/os artifact migration IBM Operational Decision Manager Version 8.7.0 Sample deployment for Operational Decision Manager for z/os artifact migration Copyright IBM Corporation 2014 This edition applies to version 8, release 7

More information

Printing Systems Division. Infoprint Manager for AIX NLV Release Notes

Printing Systems Division. Infoprint Manager for AIX NLV Release Notes Printing Systems Division Infoprint Manager for AIX NLV Release Notes Version 4 Release 2 January 13, 2005 Note! Before using this information and the product it supports, read the information in Notices

More information

IBM Storage Host Attachment Kit for HP-UX Version Release Notes IBM

IBM Storage Host Attachment Kit for HP-UX Version Release Notes IBM IBM Storage Host Attachment Kit for HP-UX Version 2.6.0 Release Notes IBM First Edition (April 2016) This document edition applies to version 2.6.0 of the IBM Storage Host Attachment Kit for HP-UX software

More information

IBM Worklight V5.0.6 Getting Started

IBM Worklight V5.0.6 Getting Started IBM Worklight V5.0.6 Getting Started Creating your first Worklight application 17 January 2014 US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract

More information

IBM License Metric Tool Enablement Guide

IBM License Metric Tool Enablement Guide IBM Spectrum Protect IBM License Metric Tool Enablement Guide Document version for the IBM Spectrum Protect Version 8.1 family of products Copyright International Business Machines Corporation 2016. US

More information

IBM Decision Server Insights. Installation Guide. Version 8 Release 6

IBM Decision Server Insights. Installation Guide. Version 8 Release 6 IBM Decision Server Insights Installation Guide Version 8 Release 6 IBM Decision Server Insights Installation Guide Version 8 Release 6 Note Before using this information and the product it supports,

More information

Printing Systems Division. Infoprint Manager for Windows NLV Release Notes

Printing Systems Division. Infoprint Manager for Windows NLV Release Notes Printing Systems Division Infoprint Manager for Windows NLV Release Notes Version 2 Release 2 January 13, 2005 Note! Before using this information and the product it supports, read the information in Notices

More information

Workplace Designer. Installation and Upgrade Guide. Version 2.6 G

Workplace Designer. Installation and Upgrade Guide. Version 2.6 G Workplace Designer Version 2.6 for Windows, Linux, AIX, Solaris, iseries Installation and Upgrade Guide G210-2219-01 Note Before using this information and the product it supports, read the information

More information

IBM XIV Provider for Microsoft Windows Volume Shadow Copy Service. Version 2.3.x. Installation Guide. Publication: GC (August 2011)

IBM XIV Provider for Microsoft Windows Volume Shadow Copy Service. Version 2.3.x. Installation Guide. Publication: GC (August 2011) IBM XIV Provider for Microsoft Windows Volume Shadow Copy Service Version 2.3.x Installation Guide Publication: GC27-3920-00 (August 2011) Note: Before using this document and the products it supports,

More information

Version 1 Release 1 November IBM Social Marketing Solution Pack User's Guide IBM

Version 1 Release 1 November IBM Social Marketing Solution Pack User's Guide IBM Version 1 Release 1 November 2015 IBM Social Marketing Solution Pack User's Guide IBM Note Before using this information and the product it supports, read the information in Notices on page 7. This edition

More information

Version 2 Release 1. IBM i2 Enterprise Insight Analysis Maintaining a deployment IBM

Version 2 Release 1. IBM i2 Enterprise Insight Analysis Maintaining a deployment IBM Version 2 Release 1 IBM i2 Enterprise Insight Analysis Maintaining a deployment IBM Note Before using this information and the product it supports, read the information in Notices on page 13. This edition

More information

Tivoli Access Manager for Enterprise Single Sign-On

Tivoli Access Manager for Enterprise Single Sign-On Tivoli Access Manager for Enterprise Single Sign-On Version 6.0 Installation and Setup Guide GC23-6349-03 Tivoli Access Manager for Enterprise Single Sign-On Version 6.0 Installation and Setup Guide GC23-6349-03

More information