Java Reference
In-Depth Information
Resolved
import
javax.servlet
version="2.4.0"
export
javax.servlet
version="2.4.0"
Jetty
Servlet
A P I
Web
application
Tomcat
Figure 2.18 If a bundle is
already resolved because it's
in use by another bundle, this
bundle is preferred to bundles
that are only installed.
import
javax.servlet
version="2.4.0"
export
javax.servlet
version="2.5.0"
Installed
framework favors already-resolved packages as a means to minimize the number of dif-
ferent versions of the same package being used. Let's summarize the priority of
dependency resolution candidate selection:
Highest priority is given to already-resolved candidates, where multiple matches
of resolved candidates are sorted according to version and then installation
order.
Next priority is given to unresolved candidates, where multiple matches of unre-
solved candidates are sorted according to version and then installation order.
It looks like we have all the bases covered, right? Not quite. Next, we'll look at how an
additional level of constraint checking is necessary to ensure that bundle dependency
resolution is consistent.
2.7.2
Ensuring consistency with uses constraints
From the perspective of any given bundle, a set of packages is visible to it, which we'll
call its class space . Given your current understanding, you can define a bundle's class
space as its imported packages combined with the packages accessible from its bundle
class path, as shown in figure 2.19.
A bundle's class space must be consistent,
which means only a single instance of a given
package must be visible to the bundle. Here,
we define instances of a package as those with
the same name, but from different providers.
For example, consider the previous example,
where both the servlet API and Tomcat bun-
dles exported the javax.servlet package.
The OSG i framework strives to ensure that
the class spaces of all bundles remain consis-
tent. Prioritizing how exported packages are
selected for imported packages, as described
Bundle A's
bundle class path
Bundle B's
bundle class path
Imported/Exported
classes
Figure 2.19 Bundle A's class space is
defined as the union of its bundle class
path with its imported packages, which
are provided by bundle B's exports.
Search WWH ::




Custom Search