Java Reference
In-Depth Information
Figure 9.8 Bnd maintains a list
of bundle repositories that are
used for compiling and running
bundles. To ensure your compile-
time dependencies are avail-
able, you can add them to the in-
ternal bndtools repository.
role is to define the bnd repository. Bndtools prepopulates the repository with various
useful bundles, like JU nit and the Felix Declarative Services implementation, but you'll
need to add bundles for your enterprise OSG i runtime environment, like a Blueprint
implementation, and perhaps a database.
You can populate the repository using the bnd file, but the simplest way is to use
the bndtools' Repository View, in the bottom left corner of the OSG i perspective,
which has an Add Bundles to Repository icon. You'll need to add your bundles to a
specific repository, so the icon isn't active unless an existing repository is highlighted
(see figure 9.8).
SETTING THE BUNDLE BUILD PATH
Although the bnd repository is similar in sev-
eral ways to the PDE target platform, the two
aren't the same. One important difference is
that it's not sufficient to add a bundle to the
bnd repository for it to be part of a bundle's
compile path; the bundle must also be
added to the bndtools build path. This
makes getting everything compiling in bnd
harder than it could be, but it does ensure
no unwanted dependencies creep into a
bundle's package imports. In a way, setting
the bnd build path is like adding package
imports in PDE , although you'll probably
have to add fewer bundles to the build path
than imported packages (see figure 9.9).
Figure 9.9 You'll need to add the bundles
your project depends on in the Build tab in the
bndtools bnd file editor.
EDITING BND FILES
The bndtools include a nice .bnd file editor.
As well as editing the .bnd source directly,
you can use a GUI to specify your private and
exported packages, and see bnd's calculated
imports (see figure 9.10).
Figure 9.10 Bndtools will show you the
calculated imports for each bundle, which
can help avoid runtime surprises. You can
even see which classes are using the
imported packages.
Search WWH ::




Custom Search