Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
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.