3.5. The Framework

The framework provides a hosting environment for bundles. Its responsibilities are

  • Managing the life cycle of bundles

  • Resolving interdependencies among bundles and making classes and resources available from a bundle

  • Maintaining a registry of services

  • Firing events and notifying listeners when a bundle's state changes, when a service is registered or unregistered, or when the framework is launched or raises an error

The framework is the common ground where all installed bundles and registered services come to play. It is agnostic to the specific applications of individual bundles, and is only concerned with the generic housekeeping for all bundles. The framework's functionality is best illustrated when we describe how the framework interacts with bundles and services, in Section 3.7.

The framework remains a behind-the-scene character: There is no org.osgi. framework.Framework interface or class in the API, and thus no instance of the framework can be obtained. A bundle accesses the functionality of the framework indirectly through the bundle context.

As shown in “The Bundle Activator” on page 31, the bundle activator's start and stop methods are both passed an org.osgi.framework.BundleContext object as the sole argument. For classes inside the bundle, this object is the “window” into the framework: It represents the execution environment in which the bundle finds itself.

For human developers, the Java Embedded Server command console provides interactive access to the underlying framework, as we saw in the previous chapter.

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

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