Руководство по инструменту: Creating a Service Model using RSA
This tool mentor describes the steps for creating a simple service model using Rational Software Architect.
Инструмент: Rational Software Architect
Взаимосвязи
Связанные элементы
Основное описание

Purpose

The steps in this tool mentor match those in the task. Links to topics in the Rational Software Architect (RSA) online Help are marked with .

Overview

This tool mentor describes the steps for creating a simple service model using RSA. The UML Profile for Software Services and the template model described in this tool mentor may not be installed in earlier versions of RSA. A downloadable package which contains these items and installation instructions is available from IBM developerWorks.

The following steps are performed in this tool mentor:

Develop Architecture Overview 

Create a New Modeling Project

This step will also create a Service Design Model, once complete jump to step number 3.

  1. From the RSA menu, select File --> New --> Project.
  2. In the resulting wizard, select the "Modeling" folder and then the "UML Project" from the tree. If these elements are not visible in the tree, check the box "Show All Wizards" just below the tree. Select the Next button.
  3. Give your project a name such as "my.first.servicemodel.project" and then select the Next button.
  4. From the list of model templates, select "Service Design Model" and then select the Next button.
  5. When presented with the list of projects you may reference, select the Finish button.

For more information on creating a new project, see the State Transition topic in the Rational Rose online help.

Create a New Service Design Model

If you already have a modeling project, this step will add a Service Design Model to your project.

  1. Select the project to add the Service Design Model to.
  2. From the RSA menu, select File --> New --> Other.
  3. In the resulting wizard, select the "Modeling" folder and then the "UML Model" from the tree. If these elements are not visible in the tree, check the box "Show All Wizards" just below the tree. Select the Next button.
  4. From the list of model templates select "Service Design Model" and if you wish, you can choose a new name for your model. Select the Finish button.

Creating Messages for your Service from the Model Library

  1. In the package named "Message View," create a new Class named Customer.
  2. Create another new Class named Address.
  3. Create an aggregation association from Customer to Address.
  4. Open the model library named "Reusable Design Elements" and ctrl-drag the <<Message>> Class into the message view package.
  5. Right-click on the newly created class in the message view and select "Find/Replace...."
    1. In the dialog type, the text "${service.message}" in the "Find What" text box.
    2. Select the "Replace" button.
    3. In the dialog type the text "CreateCustomer" in the "Replace with" text box.
    4. Select OK.
  6. Drag the new message class onto the class diagram with Customer and Address and add an aggregation association from CreateCustomer to Customer.
  7. Now ctrl-drag another <<Message>> Class into the message-view package and rename it "UpdateCustomerAddress" using the find/replace dialog.
  8. Drag the new message class onto the class diagram and add an aggregation association from UpdateCustomerAddress to Address.

Creating a new Service and Provider

  1. Ctrl-drag the <<ServiceProvider>> Component into the service view package and, using the find/replace technique described above, rename it "CustomerInfo" (the "Find what" text is "${service}" in this case).
  2. The actual elements created are:
    1. A Component named "CustomerInfoProvider" with a nested composite structure diagram.
    2. An Interface named ICustomerInfo stereotyped as a <<ServiceSpecification>> and containing an Activity diagram.
    3. A Port on the component named CustomerInfo stereotyped <<Service>> and typed as ICustomerInfo.
  3. Add an operation to ICustomerInfo called "createCustomer" and add a parameter typed with the CreateCustomer message created above.
  4. Add another operation called "updateCustomerAddress" and add a parameter typed with the UpdateCustomerAddress message created above.

Creating a Service Partition

  1. Create another service, following the instructions above, but name it "AccountMgmt" (no need to add operations in this case).
  2. Ctrl-drag the <<ServicePartition>> Node into the collaboration view package and, using the find/replace technique above, rename it "Back Office." The "Find what" text is "${partition}" in this case.
  3. Open the structure diagram nested in the partition and add two parts to the diagram, when prompted choose to select an existing element, and choose the two service providers created so far.
  4. This should result in the parts not only being typed but also displaying the ports and interfaces associated with the providers.
  5. To create a service channel between the two services, choose the Connector from the toolbox and connect to the two ports.
    1. Stereotype the connector <<ServiceChannel>>.
    2. Select the Advanced tab in the properties view and set the binding to "RMI."

To create a strict partition and expose only the AccountMgmt service, follow the additional steps below.

  1. Right click on the Partition in the Model Explorer and add a new Port.
  2. Name the Port and set its stereotype to <<ServiceGateway>>.
  3. In the properties view, set the Type of the Port to the IAccountMgmt service specification.
  4. Open the composite structure diagram we created above and see that the new Port is shown on the diagram.
  5. Create a <<ServiceChannel>> from service gateway to the AccountMgmt service.