Ports

In composite structure diagrams, a port defines the interaction point between a classifier instance and its environment or between the behavior of the classifier and its internal parts.

Because all interactions between the external environment and the internal parts must pass through a port, you can use a port to isolate the internal parts of an object from its environment. Connectors link ports to properties of the classifier and invoke communication between two or more instances. You can define multiple ports for a classifier to show different interactions depending on the port from which the interaction originates.

As the following figure illustrates, a port is displayed in the diagram frame as a small square with the name of the port.

A diagram frame shows three parts:
two are typed with the classifier Wheel and the other is typed by the classifier
Engine. A straight connecting line links the Engine part to a small square
port with the type Car, which is displayed on the external border of the composite
structure diagram. The connecting line has an open arrowhead that points toward
the car port. The two Wheel parts are connected by a straight line to a small
square port with the type Engine.

You can add ports to the border of a composite structure diagram and to the interior parts of the composite structure diagram. In the above example, a delegate connector links the Port:Car port on the external structure compartment to the internal part named e:Engine. An assembly connector links the two internal parts of front:Wheel[2] and rear:Wheel[2] to the internal port named Port:Engine.

A port can interact in both directions and you can add required and provided interfaces to specify the types of interactions that can occur between a classifier and its environment.

As the following figures illustrates, a port is an interaction point between a classifier and its environment and it can group any number of required and provided interfaces into a logical interaction that a classifier can have with the outside world.

A diagram frame shows one part
and two ports. The part with the type Seat, is displayed inside the frame.
A small square port appears on the top-left corner of the part and there is
a circle connected to the top of the port by a small straight line. The circle
is a provide interface labelled SafetyDevice. On the external border of the
composite structure diagram, a small square port is attached by a solid line
to a half circle on the bottom of the port. The half circle is a required
interface labelled Gasoline.

In the above example, the Car classifier has two ports. The external port Engine:PowerGenerator has a required interface Gasoline that the Car class needs to operate the car. The internal port DriverSeatbelt:Seatbelt has a provided interface SafetyDevice that the Car class offers to the driver to operate the car.

You can change the position of a port in a composite structure diagram by using the isService property of the port. If the isService property is set to true, the port appears on the border of the composite structure diagram, indicating that the port is required by its environment. If you set the property to false, the port moves inside the structure compartment, indicating that the port is used only for internal implementation of the classifier and is not required by its environment. When the isService property is set to false, you can delete or modify the port without affecting the use of the classifier.

Related concepts
Interfaces
Related tasks
Adding ports to composite structure diagrams
Connecting parts and ports in composite structure diagrams
Adding interfaces to modeling diagrams
Defining required and provided interfaces on ports
Feedback
(C) Copyright IBM Corporation 2004, 2005. All Rights Reserved.