The shared service registry

As part of the activation process, a bundle may register services with the framework's service layer registry. Services are meant to be shared among bundles in the framework.

When a bundle needs to publish a service for use by other bundles, it instantiates that service. Then using the service interface, which will identify the service within the framework, the bundle registers the service with the framework-shared service registry.

From this point, until the bundle unregisters the service, other bundles can then find and get the service, using the service interface to look it up without knowing which bundle has provided it.

Services and their interfaces can be defined and implemented by any provider (or vendor). However, there are a standard set of interfaces for some of the commonly used services defined by the OSGi specifications. This standard definition allows vendors to provide their own implementations of a service, without binding the service consumer to their proprietary interface.

As we will see in Chapter 9, Improving the Bookshelf Service with iPOJO, there are also a few ways to abstract away from the service registration and lookup process by using a configuration-based service definition and injection.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.7.240