Java Reference
In-Depth Information
Bundle B
Package X
Private
Public
Public
Private
Bundle A
PPa
Package X
ckage
e eX
Package Z
PackageZ
ckage
Class space of bundle A
Public
Bundle C
P
Package Y
k
Y
Private
Figure 1.8 The class space for a bundle includes all of its private classes, and the public classes of
any bundle it's wired to. It doesn't necessarily include all the bundle's public classes, because some
might be imported from other bundles instead.
when attempting to load any class or resource in that package. In addition to the bundle
classloaders, there are environment classloaders which handle core JVM classes.
Each classloader has well-defined responsibilities. If a classload request isn't dele-
gated to another bundle, then the request is passed up the normal classloader delega-
tion chain. Somewhat surprisingly, this means that being included in a bundle doesn't
guarantee that a package will be loaded by that bundle. If that bundle also has an
import for the package that's wired by the framework resolver, then all class loads for
that package will be delegated elsewhere! This is a principle known as substitutability . It
allows bundles to maintain a consistent class space between them by standardizing on
one variant of a package, even when multiple variants are exported. Figure 1.8 shows
the class space for a bundle that exports a substitutable package.
SERVICES AND THE SERVICE REGISTRY
Bundles and bundle lifecycles are as far as many OSG i developers go with OSG i. Enter-
prise OSG i makes heavy use of another fundamental OSG i feature—services. OSG i ser-
vices are much more dynamic than their Java Enterprise Edition (Java EE ) alternatives.
Search WWH ::




Custom Search