Logo
HomeDocumentationDownloadPublicationsContactEventsCommunityLinks

3. Applying a composition adapter

The adapters category of the compositions toolbar does not contain regular composition patterns, but composition adapters. Composition adapters are able to capture some concerns that coudn't be cleanly modularized using just components and composition patterns. Typical examples of such concerns are all concerns involving tracing, logging, etc...

For this tutorial, we will again work with the Juggler example. First, clear the canvas by pressing the create diagram button, which is the leftmost button in the toolbar. Then, place the start filter composition adapter on the canvas. You'll  notice that this composition adapter has three roles. The filter role looks like a normal role of a composition pattern. The src and dst roles are part of the context of the composition adapter and have to be mapped on roles of a composition pattern. The documentation of a composition adapter can be viewed by double-clicking on it. Now, place the ToggleControl composition pattern from the Misc catgeory on the canvas. First, we have to indicate that the star filter composition adapter will be applied on the ToggleControl composition pattern. Do this by dragging the ToggleControl composition pattern onto the white oval of the start filter composition adapter. Mapping a role of the composition adapter on a role of a composition pattern is as simple as dragging them onto each other. Now, drag the Src role of the composition adapter onto the Control role of the composition pattern and the Dst role onto the Subject role. The canvas should look like the following screenshot now.

Now, we have to manually ask the program to verify whether this composition adapter is valid (this should be automated in one of the next versions). Press the right mouse button on the composition adapter and press approve composition, normally the tool doensn't complain. Now, we can again drag the JButton component on the Control role and the Juggler component onto the Subject role. The filter role could be played by the ViewFilter component from the Misc category. Drag the ViewFilter component on the filter role. All roles are filled, so code-generation can start. When the generated application starts you'll notice that only the start event is sent through the viewfilter component, the stop event still goes straight to the Juggler.

<<    Getting Started With PacoSuite    >>
2003-02-19 15:01:44 - Wim Vanderperren

Latest build of the PacoSuite tool-suite can be found in the download section.

2003-02-19 15:01:19 - Wim Vanderperren

PacoSuite Website online.

SSELŠ2003-2004 visits: 55403