Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Interface

A provided interface is a lollipop, a small circle on a stem. A required interface is a socket, a half-circle on a stem. Interfaces are declared inside a component with provides and requires, and drumlin decides how to draw them.

Assembly

A required and a provided interface with the same name are wired together. Which notation drumlin uses depends on where the interfaces are declared, following UML 2.5.1, clause 11.2.4.

Between two simple ports (ports with one interface each), drumlin draws a ball-and-socket assembly connector with the ball inside the socket. The notation is reserved for simple ports, so anything else keeps the socket and the lollipop apart: when an end has no port, the socket and lollipop are joined by a dashed dependency arrow from socket to lollipop, as in Figure 11.46. A port with more than one interface is joined with a plain connector named after the interface.

With no ports:

component Consumer { requires IQueue }
component Broker { provides IQueue }
Consumer Broker IQueue

Between two simple ports:

component Consumer { port in requires IQueue }
component Broker { port out provides IQueue }
Consumer Broker IQueue in out

Unconnected interfaces

An interface with no partner is drawn as a stub at the component boundary. A provided interface has a lollipop and a required interface has a socket.

component Codec {
  provides IEncode
  provides IDecode
  requires IAllocator
}
Codec IAllocator IDecode IEncode

Several interfaces

Separate names with commas.

component Runtime { provides ITimer, IThreads, IFiles }
component App { requires ITimer, IThreads, IFiles }
Runtime App IFiles IThreads ITimer

Several consumers

Each consumer gets its own connection to the provider.

component Logger { provides ILog }
component Net { requires ILog }
component Disk { requires ILog }
component UI { requires ILog }
Logger Net Disk UI ILog ILog ILog

Inside composites

Matching also works inside a composite and across nesting levels.

component App {
  component Controller { requires IRepo }
  component Repo { provides IRepo }
}
App Controller Repo IRepo

Syntax

provides <interface> [, <interface>]...
requires <interface> [, <interface>]...

Both go inside a component. On a port, use port p provides I or port p requires I. See Port. In a package diagram an interface is a boxed classifier instead: see Classifier.

Specification

UML 2.5.1, 10.4.4 (p. 172): lollipop and socket; a dependency arrow from a usage to a realization may join socket to lollipop. Components: 11.6.4 (p. 210) and Figure 11.46 (p. 214). Ball-and-socket: 11.2.4 (p. 186), which permits it only for simple ports and forbids it for complex ports and parts without ports.

Used in

Compiler pipeline, Debugger, API gateway, Container runtime.