concept OSGi container in category spring

appears as: OSGi container, n OSGi container, The OSGi container, OSGi containers, OSGi containers, OSGi container
Spring Dynamic Modules in Action

This is an excerpt from Manning's book Spring Dynamic Modules in Action.

A developer can install a bundle in an OSGi container; this is the first state a bundle can take: “installed”. Then, based on the container’s default settings, commands issued through an administration console, or even programmatic calls, the newly installed bundle can transition through different states. It can, for example, be resolved, meaning that all its dependencies are met and that it can now make some its own Java packages visible to other modules. There are several states available in OSGi, and section 2.1.4 of chapter 2 describes them all.

Spring DM manages all of these containers in a convenient and nonintrusive way. No code or configuration is required inside a bundle to configure, start, or destroy a Spring container. All that’s required is that Spring DM’s bundles are installed in the OSGi container, and that the bundle includes a Spring application context configuration file. The Spring DM bundle in charge of managing Spring-powered bundles is called the Spring DM extender. Figure 1.8 illustrates these mechanisms.

Figure 1.8. The Spring DM extender is an OSGi bundle that scans bundles for Spring configuration files and manages (creates, destroys, and updates) a Spring application context on their behalf.

Spring DM monitors the bundle lifecycle in order to determine when to trigger the appropriate actions. Once Spring DM is deployed inside an OSGi container, it can automatically detect Spring-powered components based on the presence of the Spring application context configuration file as well as through certain dedicated headers in the manifest file of the bundle. When a bundle with the appropriate configuration is started, a Spring container is also configured and embedded inside the component. By doing this, Spring DM implements the Extender pattern.