tree: 57a0fcebd8d5d97d58eee306b41dfd7da36ce7d3 [path history] [tgz]
  1. karaf-bundle-example-client/
  2. karaf-bundle-example-common/
  3. karaf-bundle-example-features/
  4. karaf-bundle-example-provider/
  5. pom.xml
  6. README.md
examples/karaf-bundle-example/README.md

Apache Karaf Bundle Example

Abstract

One of the kind of applications you can deploy in Apache Karaf is obviously OSGi bundle.

The bundle is the core deployment unit when using OSGi. It's basically a regular jar file containing some additional headers in the MANIFEST used by the OSGi framework, and so Karaf.

Artifacts

  • karaf-bundle-example-common provides the BookingService interface and Booking POJO.
  • karaf-bundle-example-provider implements and exposes a BookingService in the OSGi service registry.
  • karaf-bundle-example-client exposes a new ClientService using the BookingService. This service is used to periodically manipulate the BookingService.
  • karaf-bundle-example-features contains a Karaf features repository used for the deployment.

## Build

Simply use:

mvn clean install

## Feature and Deployment

On a running Karaf instance, you register the bundle example features repository with:

karaf@root()> feature:repo-add mvn:org.apache.karaf.examples/karaf-bundle-example-features/LATEST/xml

Then you can install the karaf-bundle-example-provider feature:

karaf@root()> feature:install karaf-bundle-example-provider

Now, you can install the karaf-bundle-example-client feature:

karaf@root()> feature:install karaf-bundle-example-client

When you install the client feature, you should see on the console:

karaf@root()> 1794197511025182174 | John Doo | AF3030