Whiteboard Pattern

Whiteboard Design Pattern is an OSGi service model, which influences the OSGi framework’s service registry. Whiteboard pattern came into existence because of complicated and error prone nature of traditional model: The Listener Pattern (aka Observer Pattern).[1]

This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)

The topic of this article may not meet Wikipedia’s general notability guideline. (October 2018)
This article may be too technical for most readers to understand. (August 2018)
This article is an orphan, as no other articles link to it. Please introduce links to this page from related articles; try the Find link tool for suggestions. (November 2016)

OSGi service model is a collaboration model which supports service registry. The service registry allows applications or bundles to register services, which are simple Java interfaces to implement different functionalities. The dynamic nature of the service registry is useful to track the services that can show up or leave at any time. Whiteboard Pattern is created to support such OSGi service model, which was not supported by Listener Pattern.[1][2]

. . . Whiteboard Pattern . . .

Listener Pattern Architecture

The Listener Pattern is typically known as Observer Pattern. It is a Behavioral Pattern (aka Publish-Subscribe), which deals with dynamic changes in the state of different objects.

Listener Pattern follows a structure where an event listener is registered to event source. Now whenever an event source changes its state, all its event listeners get notified about the change through event object. In this pattern, everything is controlled by event source.

Implementation of Listener pattern is very complicated. Listener pattern supports many event listeners, so all listeners are registered to an event source. No event listener has access control over an event source, so for every service a new file is to be created. This creates an overhead of class file and affects the program running time and memory usage. Also, when an event listener is exiting, its registration is to be cancelled from the event source. Vice versa, when an event source is exiting, it makes sure that all its event listeners‘ references are removed. Here it is assumed that clean up is done automatically, but some embedded applications which are running continuously and are highly dynamic, this assumption cannot be verified and creates a significant issue.

Whiteboard Pattern Architecture

Whiteboard Pattern can be suggested by a role, where an event listener is looking for a special service. Another role could be when an event listener is looking for a looked service.

Whiteboard Pattern follows a structure where an event listener is registered to event source. This service registration is maintained by service registry, which is application programming interface for managing services. Bundle implements this interface and registers the service in service registry. Bundles are typically a group of Java classes, furnished with well-written manifest file, which help to bind with many other services. Now, an event listener can find the service in the service registry, or react to it when the service is executed. In this pattern, control is given to an event listener.

Implementation of Whiteboard Pattern is complex, because it has to handle all the services dynamically. To handle this dynamic nature Whiteboard Pattern is implemented using application bundles and server bundles. As the framework registry can be reused dynamically, the implementation becomes easier. Both application bundles and server bundles are responsible for managing the services and their inter-dependencies to the framework.[1][3]

  • Adding new bundles is easy.
  • Contributed and configured bundles can be consumed by any number of subsystems in any way. Thus, registry supports configuration management.
  • Testing for bundles and their connection with each other is easy.
  • Implementation and debugging is easy because it reuse the framework registry. Implementing the same service using Listener Pattern is tedious work and cannot be reused.
  • It is secured. As event listeners have access controls over event source and for every status change event listeners get notified, whereas there is no access to event listeners in Listener Pattern.

. . . Whiteboard Pattern . . .

This article is issued from web site Wikipedia. The original article may be a bit shortened or modified. Some links may have been modified. The text is licensed under “Creative Commons – Attribution – Sharealike” [1] and some of the text can also be licensed under the terms of the “GNU Free Documentation License” [2]. Additional terms may apply for the media files. By using this site, you agree to our Legal pages . Web links: [1] [2]

. . . Whiteboard Pattern . . .