OSGi Blueprint Container Specification

The OSGi Blueprint Container Specification defines a dependency injection framework for OSGi derived from the Spring Dynamic Modules project. The specification defines a component model for OSGi based on the core Spring framework in which an OSGi bundle is augmented by an XML module blueprint. A module blueprint is a configuration file that describes how fine-grained components are wired together within the bundle. For more information about the OSGi Blueprint Container Specification, see the Compendium Specification on the OSGi Alliance website.

Module components are managed by a module context container, a direct equivalent of the Spring application context container that injects configured dependencies into the components and manages their lifecycle. The format of the module blueprint is based on the Spring application configuration file. The significant evolution from the Spring framework is the unit of deployment, which is known as an OSGi bundle, and the integration with the OSGi service registry through the module blueprint. OSGi services that are exposed to clients of the bundle and OSGi services that are consumed by the bundle are declared in the module blueprint and registered with or retrieved from the OSGi service registry by the runtime module context container.

In a Blueprint application, a module component is a Java™ component in which the lifecycle is managed by a module context container. The module component configuration includes references to resources and components on which it depends. The module context container injects the configuration into the module component. Having the configuration injected into the component, rather than the component being dependent on external factories and services, makes it easier to test the component in isolation.

A module context container is a set of managed components that are assembled into an OSGi bundle. The module context is responsible for managing the lifecycle of the managed component that it contains and for the injection of the component configurations.

Learn more about OSGi Blueprint concepts:
The OSGi Blueprint Container Specification defines the following concepts:
Managed component
A managed component is a Java component whose lifecycle is managed by a container and whose configuration, including references to resources and the other components it depends on, is injected into it by the container. Having the configuration is injected into a component, rather than the component being dependent on external factories and services, makes it easy to test the component in isolation.
Module context
A module context is the container of a set of managed components that are assembled into an OSGi bundle. It is responsible for managing the lifecycle of its managed components and injecting the components' configuration. This terminology is derived from the Spring framework's “application context” container and is a little clumsy, especially as the Blueprint specification uses the term “module context” as shorthand both for the “module context container” and “module context configuration file”. In the EBA programming model, the term EBA container is introduced and means the same as module context container.
Module blueprint
A module blueprint is the declarative configuration that is associated with the set of managed components in an OSGi bundle that is processed by the module context container. In the Blueprint specification, a module blueprint takes the form of one or more XML module context configuration files for which the Blueprint specification defines an extensible XML schema.
Managed bundle
A managed bundle is an OSGi bundle that contains a module blueprint that describes the set of managed components in the managed bundle.

The declarative configuration in the module blueprint can also specify that certain managed components of the bundle must be exported as services in the OSGi service registry. In addition, it is possible to declare that the managed component of a bundle depends on a service or set of services that are obtained through the service registry, and for those services to be injected into the managed component.

Overall, the OSGi Blueprint Container Specification describes an application architecture in which application modules are implemented as OSGi bundles with a module blueprint (the configuration information) and a runtime context that is created from that blueprint. Modules are peers, which interact through the service registry.

Icon that indicates the type of topic Concept topic
Timestamp icon Last updated: July 17, 2017 21:58

File name: cosgiblueprint.html