Java Reference
In-Depth Information
Depending on what you're trying to do, you may need to install other bundles into
your Karaf runtime. As you've seen, the ability to group bundles into features and the
support for Maven URL s make this pretty easy. Karaf has another handy protocol han-
dler that simplifies installing normal JAR s.
Handling non-OSGi bundles
Karaf ships the Pax Wrap URL handler. This convenient utility allows you to install
normal bundles into the Karaf runtime by converting them into OSG i bundles on the
fly. Bnd is used to do the generation of the bundles. For example, to install a legacy
bundle, the following command could be used (or the URL could be added to a fea-
ture definition file):
bundle:install wrap:mvn:company/my.legacy/1.0.0
So far, we've shown you two Karaf commands: features:install and bundle:install .
These are only scratching the surface of the capabilities of the Karaf shell.
Blueprint-aware console
Karaf has a slick text console based on the Felix Gogo shell, but with lots of improve-
ments and extensions. The Karaf shell allows you to do all the things you could do in a
normal OSG i console, like starting, stopping, and querying bundles, but with the wel-
come benefit of content assist and command history. Importantly for products built
on top of Karaf, the console can be dynamically extended with new commands and
rebranded. From an enterprise OSG i perspective, though, the most interesting feature
of the Karaf console is its Blueprint support. Not only is the console aware of Blue-
print, Blueprint is a first-class citizen; the default bundle listing shows the Blueprint
status of every bundle (figure 13.3).
Figure 13.3 Out of the box, Karaf shows the Blueprint status when listing bundles. In this case, the
datasource JNDI name in the persistence.xml is incorrect, so Blueprint can't inject an EntityManager
into the inventory bean, and reports a failure.
Search WWH ::

Custom Search