12.6. Ports and Internal StructureChapter 11 introduced ports and internal structure of a class. Components can also have ports and internal structure.You can use ports to model distinct ways that a component can be used with related interfaces attached to the port. In Figure 12-15, the ConversionManagement component has a Formatting and a Data port, each with their associated interfaces. Figure 12-15. Ports show unique uses of a component and group "like" interfacesYou can show the internal structure of a component to model its parts, properties, and connectors (see Chapter 11 for a review of internal structure). Figure 12-16 shows the internal structure of a BlogDataSource component. Figure 12-16. Showing the internal structure of a componentComponents have their own unique constructs when showing ports and internal structurecalled delegation connectors and assembly connectors. These are used to show how a component's interfaces match up with its internal parts and how the internal parts work together. 12.6.1. Delegation ConnectorsA component's provided interface can be realized by one of its internal parts. Similarly, a component's required interface can be required by one of its parts. In these cases, you can use delegation connectors to show that internal parts realize or use the component's interfaces. Delegation connectors are drawn with arrows pointing in the "direction of traffic," connecting the port attached to the interface with the internal part. If the part realizes a provided interface, then the arrow points from the port to the internal part. If the part uses a required interface, then the arrow points from the internal part to the port. Figure 12-17 shows the use of delegation connectors to connect interfaces with internal parts. Figure 12-17. Delegation connectors show how interfaces correspond to internal parts: the Blog class realizes the DataSource interface and the Entry class requires the Logger interfaceYou can think of the delegation connectors as follows: the port represents an opening into a component through which communications pass, and delegation connectors point in the direction of communication. So, a delegation connector pointing from a port to an internal part represents messages being passed to the part that will handle it. If you're showing the interfaces of the internal parts, you can connect delegation connectors to the interface instead of directly to the part. This is commonly used when showing a component that contains other components. Figure 12-19 demonstrates this notation. The ConversionManagement component has a Controller and a BlogParser component. The ConversionManagement component provides the FeedProvider interface, but this is actually realized internally by the Controller part. 12.6.2. Assembly ConnectorsAssembly connectors show that a component requires an interface that another component provides. Assembly connectors snap together the ball and socket symbols that represent required and provided interfaces. Figure 12-19 shows the assembly connector notation connecting the Controller component to the BlogParser component. Figure 12-18. Delegation connectors can also connect interfaces of internal parts with portsFigure 12-19. Assembly connectors show components working together through interfacesAssembly connectors are special kinds of connectors that are defined for use when showing composite structure of components. Notice that Controller and BlogParser use the roleName:className notation introduced in composite structures and help form the internal structure of ConversionManagement. But assembly connectors are also sometimes used as a presentation option for component dependency through interfaces in general, as shown earlier in Figure 12-8. |