ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | oscar List | December 2005 Index

    Date Index  -->     Thread Index  -->

Using services from unstarted bundles





We started moving a project to the OSGi framework because we wanted to make
use of the module layer of OSGi and solve versioning and other classpath
issues.
In order to do this we divided our project into several bundles. These
bundles were created according to function and are library-like.

Since we're running inside an OSGi-framework we're contemplating using
services for several (pluggable) functions. Let's say we would like to use
the standard log-service for example.

The problem we're having now, is that only one of our bundles (the
application-bundle containing the entrypoint) is started. None of the
library-like bundles are started, just resolved. This means those bundles
don't have access to a BundleContext, and that means they don't have access
to services.

One solution (inspired by eclipse) is creating a Platform class in a bundle
that gets started before the application is. This bundle initializes a
static object by passing its BundleContext when it's started. Afterwards,
all library-bundles use the static Platform-class to access services or
perform other operations that require a BundleContext.

Another obious solution is starting all bundles in order to get
BundleContexts, but this is something everyone is trying to avoid due to
large startup costs.

The Platform-solution will work, but we feel it's a bit hackish, and we
were wondering if there is a better solution.
In short, what is the OSGi-answer if you have bundles that don't need/want
to be started but still need to access services (for logging for example)?

Kind regards,

Nick Hofstede



--------------------------------------------------
Inventive Designers' Email Disclaimer:

http://www.inventivedesigners.com/email-disclaimer



    Date Index  -->     Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.