Chapter 6. Building dynamic applications with OSGi services

 

This chapter covers

  • What OSGi dynamism means for your application
  • Your dependency injection options
  • How to become a Blueprint power user
  • How Blueprint interacts with OSGi dynamism
  • Detecting system changes

Dynamism is probably the most powerful, and often the most underrated, feature of the OSGi framework. A lot of people think that their applications are already dynamic because they have plug points that can be easily extended, or that dynamism isn’t that useful. It’s true that dynamism isn’t important to everyone, but it can do a lot more than most people think!

What does dynamism mean for you? Is it your friend or your foe? If you decide it’s all too hard, can you ignore it entirely? How does it affect how you write your enterprise application?

One of the key enablers of OSGi dynamism is OSGi services. Services form the basis of an extremely powerful programming model, and OSGi’s dependency injection frameworks extend that programming model to make it simple to use, too.

In this chapter, we’ll discuss how OSGi dynamism works and how to get the most out of it. We’ll also cover in detail how dependency injection and services can be used to handle dynamism with as little work as possible.

We’ll start by looking more closely at what dynamism means for OSGi applications.

6.1. OSGi dynamism

6.2. Using OSGi services

6.3. Getting the most out of Blueprint

6.4. Blueprint and service dynamism

6.5. Summary