Blueprint

From OSGi Community Wiki

Jump to: navigation, search

The Blueprint Service is a way of instantiating and consuming services provided by others by means of an external XML configuration file. It is similar in intent to Declarative Services.

Contents

Configuration

The following is an example of a blueprint service, which is stored in OSGI-INF/blueprint/*.xml

<components xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> 
  <description>Optional description for the blueprint defined in this file.</description>
  <component id="my.example.component" class="com.example.Class">
  </component>
</components>

Spring

The Blueprint service is heavily inspired by the Spring Framework.

Differences with Declarative Services

A key difference between the Blueprint Service and Declarative Services is when the instantiation of components appear. With Blueprint, the components are created as soon as the bundle is loaded; if there are any dependent services that are not present, there is a proxy which is bound and defers dynamically when a service becomes available. If a service is not present, calls to the proxy will hang until one is available.

Declarative Services, on the other hand, will not create a component until all of its dependent services are available.

References

Personal tools
Namespaces
Variants
Actions
Navigation
JavaDoc
Wiki
Toolbox