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.

A port is displayed in the diagram frame as a small square with the name of the port. You can add ports to the border of a composite structure diagram and to the interior parts of the composite structure diagram.

For example, in the following figure, the diagram frame shows three parts. Two parts are typed with the classifier Wheel and the third is typed by the classifier Engine. A straight line named Delegate connector links the internal part named e:Engine to a port on the external border of the composite structure diagram. The external port is typed with the classifier Car and is named Port:Car. The connector has an open arrowhead that points toward the external port. The two Wheel parts, named front:Wheel[2] and rear:Wheel[2], are connected by straight lines named Assembly connectors 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.

For example, in the following figure, the diagram displays a Car classifier that has one part, named carSeat:Seat, and two ports. A port, named DriverSeatbelt:Seatbelt, appears on the part and there is a circle connected to the top of the port by a small straight line. The circle represents a provide interface named SafetyDevice that the Car class offers to the driver to operate the car. On the border of the composite structure diagram, a port, named Engine:PowerGenerator, is attached by a solid line to a half circle. The half circle represents a required interface named Gasoline that the Car class needs 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.


Feedback