Java Reference
In-Depth Information
Bundle X
v 3.7
Bundle X
v 4.1
Bundle B
v 1.0.0
Bundle C
v 2.0.0
Bundle A
v 1.0.0
Figure 1.5 The transitive dependencies of a module (the dependencies of its dependencies) may have
incompatible versions. In a flat classpath, this can be disastrous, but OSGi allows the implementations
to coexist by isolating them.
1.2.2
Dynamism and lifecycle management
Dynamism isn't new to software engineering, but it's fundamental to OSG i. Just as ver-
sioning is part of OSG i to support proper modularity, modularity is arguably an OSG i
feature because it's required to support full dynamism. Many people are unaware
that OSG i was originally designed to operate in small, embedded systems where the
systems could physically change. A static classpath wasn't good enough in this kind
of environment!
Why did OSG i need a new model for dynamism? After all, in some ways, Java is
pretty dynamic. For example, reflection allows fields to be accessed and methods to be
invoked on any class by name. A related feature, proxies , allows classes to be generated
on the fly that implement a set of interfaces. These can be used to stub out classes, or
to create wrappers dynamically. Arguably another even more powerful dynamic fea-
ture of Java is URL classloaders . Classes may be loaded from a given URL at any point in
time, rather than all being loaded at JVM initialization from a static classpath. Further-
more, anyone can write a classloader.
Search WWH ::




Custom Search