Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > PHP/MySQL/Scripting

  • Print
  • + Share This
Like this article? We recommend

Example of a Mediator

The usual example given for a mediator is a GUI dialog manager. In this case, the mediator manages the lifecycle and interactions of the dialog elements: listboxes, menus, buttons, and so on. I’ll use a different type of mediator—one that models an LSP (such as the one in Figure 1) and some associated objects. The LSP has a number of attributes that require mediator services:

  • LSPs have a unique ID.
  • LSPs follow a specific path through the network.
  • LSPs have quality of service parameters.

The first two items are easy enough to understand. Item 3 simply reflects the resources allocated to an LSP along its length. These quality of service (QoS) resources are used to try to provide some degree of service differentiation to the traffic that traverses the LSP. So if the QoS is set to Best Effort, the service level is what we would expect with basic IP. If the QoS is set to a more stringent level, such as one of the levels of Assured Forwarding, the traffic service level is improved. Better QoS enables the service provider to charge more for the service!

In the code section, I have three main classes: one for modeling the LSP, one for modeling the path, and one for modeling the QoS. Each of these interdependent entities can change, and the mediator handles any such changes.

I hope I haven’t put you to sleep with all this networking stuff! Let’s now get started on the code.

  • + Share This
  • 🔖 Save To Your Account