Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

9.6. Embedding OSGi

There are two options for collocating the OSGi framework with Java EE or Java SE applications. The first option is to layer the Java EE platform or the Java SE application on top of the OSGi framework. The second option is the reverse, that is, to layer the OSGi framework on top of the Java EE platform or the Java SE application. This is commonly referred to as embedding OSGi. Because Java EE is the legacy and we have less control over it, the latter option is the most efficient and often-used approach, so it’s the one we’ll investigate further.

Quite simply, to embed OSGi, we just need to start the OSGi framework within a Java EE or Java SE application. This can be in the context of a running EJB, MDB, or other Java EE artifact, or in the case of Java SE, within the main() method. Fortunately, OSGi added a standard way of bootstrapping the framework, a process called launching. This is illustrated in the next listing.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial