Chapter 9. Blending OSGi and Java EE using JNDI

 

This chapter covers

  • Sharing resources between Java EE and Java SE applications and OSGi bundles
  • Exploring what JNDI is and how it’s used
  • Retrieving a JNDI object in an OSGi environment
  • Performing object conversions
  • Registering JNDI providers in an OSGi environment
  • Embedding the OSGi framework on top of Java EE and Java SE applications

The OSGi technology and other Java platforms, such as Java EE, can commingle. You don’t need to necessarily choose a single technology and stick to it. This is important, because it’s unlikely that you’ll be able to commit to a single technology anyway—there’s always going to be the question of integrating and supporting legacy applications. This chapter describes mechanisms that allow for integration between OSGi and legacy Java EE and Java SE applications.

We’ll start this chapter by addressing an issue that may have come to your mind when we went through the transaction-related examples of the last chapter. Specifically, how would you find a Java EE resource, such as DataSource?

9.1. Sharing resources

9.2. Understanding Java’s yellow pages

9.3. Establishing the initial context

9.4. Handling object conversions

9.5. Exposing OSGi services in JNDI

9.6. Embedding OSGi

9.7. Summary