concept OSGi service registry in category osgi

appears as: OSGi service registry, The OSGi service registry
OSGi in Depth

This is an excerpt from Manning's book OSGi in Depth.

We’ll also cover the OSGi service registry and several less common, albeit still essential, APIs of the framework, such as the event listener interfaces.

2.4.2. Registering a service in the OSGi service registry

We register a service into the OSGi service registry by using the BundleContext class provided in the BundleActivator, as shown in the following listing. We should register the Printer service when the helloworld bundle is started and unregister the service when the bundle is stopped.

Listing 2.7. Registering the Printer service in the OSGi service registry
OSGi in Action: Creating Modular Applications in Java

This is an excerpt from Manning's book OSGi in Action: Creating Modular Applications in Java.

The NetBeans platform has a lot in common with OSGi. It defines a fairly sophisticated module layer and also promotes interface-based programming using a lookup pattern that is similar to the OSGi service registry. Whereas OSGi focused on embedded devices and dynamism, the NetBeans platform was originally an implementation layer for the IDE. Eventually, the platform was promoted as a separate tool in its own right, but it focused on being a complete GUI application platform with abstractions for file systems, windowing systems, and much more. NetBeans has never been seen as comparable to OSGi, even though it is; perhaps OSGi’s more narrow focus is an asset in this case.

Table 12.1. Blueprint component container managers

Manager

Description

Bean Provides components with the same basic semantics as Spring beans:
  • Construction via reflective construction or static factory methods
  • Support for singletons or prototype instances
  • Injection of properties or constructor arguments
  • Lifecycle callbacks for activation and deactivation
Reference Gets a single service from the OSGi service registry for the component based on the service interface and an optional filter over the service properties
Reference list Gets one or more services from the OSGi service registry for the component based on the service interface and an optional filter over the service properties
Service Allows components to provide OSGi services
Environment Provides components access to the OSGi framework and the Blueprint container, including the bundle context of the component
Figure 12.1. Blueprint injects a proxy object, which masks changes in the OSGi service registry. If the underlying service provider goes away and returns, the client code is insulated from this dynamism.
Listing 15.6. Binding servlets in the OSGi service registry using iPOJO
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest