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
  • PrintPrint

13.4. Summary

The OSGi specification doesn’t define a standard launcher with a standard way to configure and launch a framework. Consequently, most OSGi framework implementations provide their own approach. The standard launching and embedding API introduced in OSGi R4.2 is the next best thing to a standard launcher, because it allows you to create a single launcher that works across framework implementations. In this chapter, you learned the following:

  • The OSGi R4.2 specification introduced the Framework interface to represent a framework instance.

  • The Framework interface extends the existing Bundle interface, which extends your existing knowledge of managing bundles to framework instances.

  • The Framework instance represents the system bundle, which provides access to the system bundle’s bundle context for performing normal bundle tasks (such as installing bundles and registering services).

  • The META-INF/services approach finds a FrameworkFactory provider, which enables framework creation without knowing a concrete framework implementation class name.

  • The OSGi specification defines numerous framework configuration properties to further improve framework implementation independence; you can pass these into FrameworkFactory.newInstance() when creating a framework instance.

  • Although using completely bundled applications is the preferred approach, the launching and embedding API also simplifies embedding framework instances into existing applications.

  • When you embed a framework instance into an application, the main constraint involves dealing with the difference between being on the outside versus the inside. If direct interaction with bundles is required, you often need to share common class definitions from the class path.

  • Other than some additional constraints, embedding a framework instance is nearly identical to launching a framework instance.


You are currently reading a PREVIEW of this book.


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


Start a Free 10-Day Trial

  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint