Top Banner
Developing Real-Time Software with Rational Rose RealTime Version 2001A.04.00 Module 12: UML Services Library
21
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: services

Developing Real-Time Software with Rational Rose RealTime

Version 2001A.04.00Module 12: UML Services Library

Page 2: services

Developing Real-time Software With Rational Rose RealTime, v2001A.04.00Copyright © 2001 Rational Software, all rights reserved

Objectives: UML Services Library

Describe the basic services offered by the UML Services Library. Timing, Frame, Log, Communication

Given a sequence diagram, use timing and log services to design and implement a Rose RT model.

Execute and debug the model. Generate a sequence diagram from the

running model to prove it meets the requirements.

Page 3: services

Developing Real-time Software With Rational Rose RealTime, v2001A.04.00Copyright © 2001 Rational Software, all rights reserved

System Services Topics

Overview System Services

Timing Frame Log Communication

Page 4: services

Developing Real-time Software With Rational Rose RealTime, v2001A.04.00Copyright © 2001 Rational Software, all rights reserved

UML Services Library Framework Classes and data types defined in UML

Services Library provide a framework in which a Rose RT application will run.

Framework defines: Messaging Timing Dynamic Structure Concurrency Event-based Processing

Page 5: services

Developing Real-time Software With Rational Rose RealTime, v2001A.04.00Copyright © 2001 Rational Software, all rights reserved

Framework Services Available

There are four services available from the UML Services Library: Timing – Provides one-shot and periodic timers Log – Provides a stream of ASCII text in which

system or application events can be recorded Frame – Permits creating/destroying capsules Communication – Provides asynchronous and

synchronous messaging between capsules

Page 6: services

Developing Real-time Software With Rational Rose RealTime, v2001A.04.00Copyright © 2001 Rational Software, all rights reserved

Sample Rose RT Model

Ping

+ / PingPort : PingPongProtocol# / log : Log+ / timer : Timing

<<Capsule>>

PingPong

+ / frame : Frame+ / timer : Timing

<<Capsule>> / pingRole

Pong

+ / PongPort : PingPongProtocol~# / log : Log+ / timer : Timing

<<Capsule>> / pongRole

PingPongProtocolping (void)pong (void)

<<Protocol>> + / PongPort~

<<Port>>

+ / PongPort~

<<Port>>+ / PingPort

<<Port>>

Page 7: services

Developing Real-time Software With Rational Rose RealTime, v2001A.04.00Copyright © 2001 Rational Software, all rights reserved

Rose RT Model and the Java Framework

Page 8: services

Developing Real-time Software With Rational Rose RealTime, v2001A.04.00Copyright © 2001 Rational Software, all rights reserved

Accessing System Services

Capsules access service protocol classes in the UML Services Library through ports

The protocols in the model correspond with Java classes in the framework

+ / PingPort : PingPongProtocol + / timer

: Timing

# / log : Log

+ / PingPort : PingPongProtocol + / timer

: Timing

# / log : Log

Timing<<Protocol>>(from rosert)Log

<<Protocol

(from rosert)

Page 9: services

Developing Real-time Software With Rational Rose RealTime, v2001A.04.00Copyright © 2001 Rational Software, all rights reserved

System Service Ports

There are predefined protocol classes for creating system service ports

Used to access three services: Timing Log Frame

Page 10: services

Developing Real-time Software With Rational Rose RealTime, v2001A.04.00Copyright © 2001 Rational Software, all rights reserved

Accessing System Services

Services are accessed in the following manner: Create a port based on the protocol class of the

required service. Call the appropriate operation on the port:

• portName.operationName (par1, … parn);

Page 11: services

Developing Real-time Software With Rational Rose RealTime, v2001A.04.00Copyright © 2001 Rational Software, all rights reserved

System Services Topics

Overview System Services

Timing Frame Log Communication

Page 12: services

Developing Real-time Software With Rational Rose RealTime, v2001A.04.00Copyright © 2001 Rational Software, all rights reserved

Timing Service

The Timing Service is used to generate timeout notification events. It provides general-purpose timing facilities

based on both absolute and relative time.

Page 13: services

Developing Real-time Software With Rational Rose RealTime, v2001A.04.00Copyright © 2001 Rational Software, all rights reserved

Timing

Examples of Timing Service operation calls : timer.informIn ( );

• creates a one-shot timer that will expire after a specified relative time

timer.informAt ( );• creates a one-shot timer that will expire at a specified

absolute time timer.informEvery ( );

• creates a periodic timeout, specified in relative time timer.cancelTimer( );

• cancels and destroys a timer that was created by one of the above calls

Page 14: services

Developing Real-time Software With Rational Rose RealTime, v2001A.04.00Copyright © 2001 Rational Software, all rights reserved

System Services Topics

Overview System Services

Timing Log Frame Communication

Page 15: services

Developing Real-time Software With Rational Rose RealTime, v2001A.04.00Copyright © 2001 Rational Software, all rights reserved

Log Service

The Log service permits printing to java.lang.System.out

Log service usage: log.log (string);

• Prints a message to the log with a carriage return at the end of the message

log.show (string); • Prints a message with no carriage return

Page 16: services

Developing Real-time Software With Rational Rose RealTime, v2001A.04.00Copyright © 2001 Rational Software, all rights reserved

System Services Topics

Overview System Services

Timing Log Frame Communication

Page 17: services

Developing Real-time Software With Rational Rose RealTime, v2001A.04.00Copyright © 2001 Rational Software, all rights reserved

Frame Service

Used for creating, destroying, plugging, unplugging capsules and querying information about contained capsules

Examples of Frame Service function: frame.incarnate (subcapsuleId); frame.destroy (subcapsuleId);

Page 18: services

Developing Real-time Software With Rational Rose RealTime, v2001A.04.00Copyright © 2001 Rational Software, all rights reserved

System Services Topics

Overview System Services

Timing Frame Log Communication

Page 19: services

Developing Real-time Software With Rational Rose RealTime, v2001A.04.00Copyright © 2001 Rational Software, all rights reserved

Communication Service

Used for passing messages between capsules in real-time, with minimal overhead Messages processed whenever CPU cycles

become available Accessed by referencing a port name with

the appropriate operations The port name is the user-defined name of the

port declared in the model Named port is generated as a member of the

capsule containing the port

Page 20: services

Developing Real-time Software With Rational Rose RealTime, v2001A.04.00Copyright © 2001 Rational Software, all rights reserved

Communication Service (cont.) The send (sendAt) operation allows asynchronous

communication via a specified port: Transition logic continues executing Response, if any, triggers a separate transition

The invoke (invokeAt) operation allows synchronous communication via a specified port: Sends message and blocks the transition until response

is received Receiver must use a reply statement

The reply operation allows asynchronous or synchronous response via the port that received the stimulus message

Page 21: services

Developing Real-time Software With Rational Rose RealTime, v2001A.04.00Copyright © 2001 Rational Software, all rights reserved

Communication Service: Message Priorities

Used to distinguish high and low priority messages when scheduling CPU time.

High priority messages usually get processed first. Scheduling policies are variable in distributed

systems, implementations change. Better designs avoid dependency on a

particular scheduling policy. To avoid implementation problems, avoid high

and low extremes.