>>>>> Jean-Baptiste Onofre <j...@nanthrax.net>:

> Hi,
> You can take a look on the karaf examples.

> Basically, you have two options:

> 1. You create a feature containing your module/bundle and the dependency 
> bundles, playing with import package
> 2. You create a uber bundle embedding the dependencies (private package or 
> embed dependency)

> The preferred approach is probably 1.

FWIW, alternative 1 is my preferred approach.

My applications consist of a cloud of bundles and a feature pulling them
in (this let me "mix and match", ie. switch between production database
and test database, and either pull in a dependency or have it be
provided).

Here's an example uber-feature:
 
https://github.com/steinarb/ukelonn/blob/master/karaf/src/main/filtered-resources/feature.xml#L16

At the top it pulls in all of the feature reposiories that are built
together with my OSGi bundles, and attached to the OSGi bundles
(creating features and attaching them, is done by the
karaf-maven-plugin).

Then I create some high level features that I use to load the
application in different configuration:
 1. ukelonn-with-derby loads the application with an in-memory test
    database with dummy data
 2. ukelonn-with-postgresql loads the application with a PostgreSQL
    database
 3. ukelonn-with-postgresql-and-provided-authservice expects an
    authservice application to already be loaded (authservice provides
    authentication and authorization using apache shiro)

Reply via email to