Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between features in Karaf and OBR

I am looking into ways to deploy and update an OSGI (Karaf, specifically) application. It seems that there are several options. One is to use The OSGi Bundle Repository (OBR), another is to use Features in Karaf, and the third is to use Karaf Cave.

I'm not really sure how these options are really different. They all seem to be doing the same things. Are they just different implementations of the same functionality? Could someone please explain the differences or provide some recommendations?

like image 355
Oleksi Avatar asked Jan 23 '12 19:01

Oleksi


People also ask

What is Karaf features?

In that case, Karaf can automatically install additional bundles or features providing the capabilities to satisfy the requirements. A feature has a complete lifecycle: install, start, stop, update, uninstall. By default, the feature service is able to detect bundles which need to be refreshed.

What is Karaf used for?

Karaf can be used as a standalone container, supporting a wide range of applications and technologies. It also supports the "run anywhere" concept (on any machine with Java, cloud, docker images, … ​) using the embedded mode. It's a lightweight, powerful, and enterprise ready platform.

What is Karaf shell?

Overview. Karaf provides a powerful console and a set of commands that can be used to perform various tasks. Commands can be located in the root shell or in a sub-shell. A sub-shell is a group of related commands, like commands related to the OSGi framework or the log system.

How do you deploy bundles in Karaf?

To add it to the deploy directory run mvn clean package from the root folder of your project (Where the pom. xml resides). This will generate a jar file in the target folder. Drag and drop it to the deploy from there.


1 Answers

Karaf features and OBR are different ways of solving the (sort of) same problem. Both allow you to install OSGi bundles into an OSGi framework, but how they decide which bundles to install is different.

With a Karaf feature, you provide a file (feature.xml, say) which explicitly lists URLs for all the bundles for the feature. They can live on the filesystem, or in a maven repository, or anywhere else which can be described by a URL.

OBR, on the other hand, works out what bundles to work out based on requirements and capabilities. It will work out the transitive dependencies of whatever you're installing as your starting point and make sure they all get installed. Usually you'd configure one or more external repositories which support the OBR format, and then an OBR resolver in your runtime would provision bundles from those repositories. So you can say "I need package org.foo" or "I need an OSGi service which implements org.bar" and the provisioner will decide which bundles best suit your requirements. OBR is more flexible and generic than Karaf features, but it might be overkill if you're just installing a well-defined set of bundles into a framework which is already primed with the infrastructure you need. It also doesn't help you if the bundles which make up your application don't have dependencies on each other - you'll still need to include them all in your 'starting set'.

The distinction gets a bit blurred, because Karaf features allow you to specify version ranges in the maven URLs, so even with a feature you can be a bit flexible in what gets provisioned. Karaf features also have an interoperability with OBR so you can write your feature definition file in terms of OBR requirements.

I believe Karaf Cave is an OBR implementation with some feature-features. So it's a server rather than a new 'technology' like features or OBR provisioning.

-- Enterprise OSGi in Action: http://www.manning.com/cummins

like image 69
Holly Cummins Avatar answered Oct 26 '22 16:10

Holly Cummins