Background

There are a couple of concepts, explained here, that help understand the dependency manager better. This page lists them.

White board pattern

The white board pattern presents a more efficient way to implement listeners. Instead of having listeners track sources and registering themselves with those sources, the white board pattern has the listeners register themselves as services in the OSGi service registry. When a source needs to notify listeners, it simply looks up all listener services in the registry and notifies them.

The pattern is explained in great detail in (warning) TODO-ref where both the traditional listener implementation and the white board implementation are compared.

Null object pattern

A null object pattern (warning) TODO-ref provides an object as a surrogate for the lack of an object of a given type. It essentially provides intelligent "do nothing" behavior, hiding the details from its collaborators. The pattern is also known as "Stub" or "Active Nothing".

The motivation for using it is that sometimes a class that requires a collaborator does not need the collaborator to do anything. However, the class wishes to treat a collaborator that does nothing the same way it treats one that actually provides behavior.

  • No labels