Java Reference
In-Depth Information
to how
OSGi improves Java. Microsoft not only learned from Java's example but also
learned from the company's own history of dealing with
DLL
hell. As a result, .
NET
includes the notion of an
assembly
, which has modularity aspects similar to an
OSG
i bun-
dle. All .
NET
code is packaged into an assembly, which takes the form of a
DLL
or
EXE
file. Assemblies provide an encapsulation mechanism for the code contained inside of
them; an access modifier, called
internal
, is used to indicate visibility within an assem-
bly but not external to it. Assemblies also contain metadata describing dependencies on
other assemblies, but the overall model isn't as flexible as
OSG
i's. Because dependen-
cies are on specific assembly versions, the
OSG
i notion of provider substitutability
isn't attainable.
At execution time, assemblies are loaded into application domains and can only be
unloaded by unloading the entire application domain. This makes the highly dynamic
and lightweight nature of
OSG
i hard to achieve, because multiple assemblies loaded
into the same application domain must be unloaded at the same time. It's possible to
load assemblies into separate domains; but then communication across domains must
use interprocess communication to collaborate, and type sharing is greatly compli-
cated. There have been research efforts to create
OSG
i-like environments for the .
NET
platform, but the innate differences between the .
NET
and Java platforms results in
the two not having much in common. Regardless, .
NET
deserves credit for improving
on standard Java in this area.
1.5
Summary
In this chapter, we've laid the foundation for everything we'll cover in the rest of the
topic. What you've learned includes the following:
The Java platform is great for developing applications, but its support for mod-
ularity is largely limited to fine-grained object-oriented mechanisms, rather
than more coarse-grained modularity features needed for project management.
■
The
OSG
i Service Platform, through the
OSG
i framework, addresses the modu-
larity shortcomings of Java to create a powerful and flexible solution.
■
The declarative, metadata-based approach employed by
OSG
i provides a non-
invasive way to take advantage of its sophisticated modularity capabilities by
modifying how projects are packaged with few, if any, changes to the code.
■
The
OSG
i framework defines a controlled, dynamic module lifecycle to simplify
management.
■
Following good design principles,
OSG
i promotes an interface-based program-
ming approach to separate interfaces from implementations.
■
With this high-level understanding of Java's limitations and
OSG
i's capabilities, we can
start our adventure by diving into the details of the module layer in chapter 2. This is
the foundation of everything else in the
OSG
i world.