Java Reference
In-Depth Information
Maven URL s were used for convenience here, but file and http URL s also work. The
feature definition file for the Fancy Foods application would be as follows:
<features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0">
<feature name="fancyfoods" version="1.0.0">
<bundle>mvn:fancyfoods/fancyfoods.api/1.0.0</bundle>
<bundle>mvn:fancyfoods/fancyfoods.web/1.0.0</bundle>
<bundle>mvn:fancyfoods/fancyfoods.business/1.0.0</bundle>
<bundle>mvn:fancyfoods/fancyfoods.datasource/1.0.0</bundle>
<bundle>mvn:fancyfoods/fancyfoods.persistence/1.0.0</bundle>
<bundle>mvn:fancyfoods/fancyfoods.department.chocolate/1.0.0</bundle>
<bundle>mvn:fancyfoods/fancyfoods.department.cheese/1.0.0</bundle>
</feature>
</features>
It's used here because the content is familiar, but the Fancy Foods application perhaps
isn't the best example of how to use Karaf features. A similar effect can be achieved by
packaging all of the Fancy Foods bundles up into a .eba file, as we did in chapter 4.
Features are more useful for distributing centrally—or remotely—managed infra-
structure bundles. For example, many Apache projects provide Karaf feature files to
allow them to be installed into Karaf without any initial download.
If you try to install it, you'll discover that the Fancy Foods application won't install
correctly on a basic Karaf installation because its dependencies are missing; current
releases of Karaf don't have any ability to provision features based on bundle depen-
dencies. Don't worry, we'll show you how to configure Karaf with the right features in
a moment.
13.2.2
Installing Aries into Karaf
Despite being a relatively lightweight runtime, Karaf has awareness of, and support
for, Aries. Base Karaf ships with the Aries Blueprint implementation. Although not
installed by default, the Karaf enterprise repository includes feature definitions for
most Aries components. The feature definitions are maintained by the Karaf team
and so versions may lag slightly behind the latest Aries releases (see figure 13.2).
WARNING: BUT WHERE IS THE ARIES FEATURE? None of the Karaf feature defi-
nitions for the Aries bundles includes aries in the name, so they're easy to miss
if you're looking for a feature called aries .
Unfortunately, although there are Karaf feature files for the Aries JPA component,
which provides integrations for JPA in an OSG i environment, at the time of writing
there are none for the Open JPA engine itself. You'll need to install Open JPA into
Karaf manually, either by using the bundles:install command or by writing your
own feature for Open JPA . Because Open JPA has its own nontrivial dependencies, a
feature is probably easier. An example feature definition is as follows:
<features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0">
<feature
name="persistence"
Search WWH ::




Custom Search