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
Share this Page URL
Help

Chapter 4. In-depth look at bundles and ... > Understanding OSGi’s class loading

4.5. Understanding OSGi’s class loading

So far you’ve learned different mechanisms for importing a class in OSGi. A bundle may import the class from another bundle by using the Import-Package header or the DynamicImport-Package header; a bundle may also rely on its own class path (a private package) or use fragments. This process of searching for a class, or more precisely for any resource, as you’ve probably guessed, isn’t a simple one.

First, it’s useful to model the entire searchable space of a bundle as a four-layer architecture, as shown in figure 4.11. At the top level is the boot class loader, which is the parent class loader for all the bundles’ class loaders. Below it are all the packages that are imported from a separate bundle. Next is the bundle’s own internal class path, as specified by the Bundle-Classpath header. And finally comes the class path of any attached fragments.


  

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