4.6. Relevant org.osgi.framework APIs

Until now we've come across a number of OSGi APIs, which are summarized here. We use a few fictional services (for example, PrintService) in our examples. Their particular service interfaces and implementations are of little interest to our discussion and are not shown.

The emphasis is on how to use these APIs through examples. The formal and complete API specification can be found in Appendix B.

4.6.1. BundleContext Interface

The BundleContext APIs allow you to register services with the framework's service registry, to query registered services, and to retrieve services from the registry. You can also access a per-bundle private, persistent data storage area by using the BundleContext API.

An instance of ...

Get Programming Open Service Gateways with Java Embedded Server™ Technology now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.