celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Broekhuis <a.broekh...@gmail.com>
Subject Re: some remarks and questions
Date Fri, 09 Sep 2011 08:02:03 GMT

Could you post a new thread for new questions? Someone searching for
something might now miss posts, since an "old" thread is being continued.

>                The paint example in Celix uses Gtk as GUI package. I have
> several bundles that perform GUI actions, however the GUI is initialized in
> the activation of one paint-frame bundle. The activation of the paint-frame
> bundle should therefore be done before the other bundles are activated
> because they also use Gtk facilities. Do you have  a suggestion how to
> organize this?
Short answer, let the paint-frame bundle expose a service and use a service
tracker to depend on it.

Longer answer:
The OSGi spec describes something like start levels which can be used, Celix
doesn't support this. But looking at the inherent dynamic behaviour I thinks
it is also a bad usage model in most (if not all) cases. For example, if
start levels are used, but later on a bundle would be updated (or even
uninstalled) all bundles implicitly depending on the first bundle might
start behaving strange.

A proper solution for this would be to make all other components (requiring
the gtk initialization) depend on the first component. To solve this, the
initialization component can expose a service (might even be an empty
service which is only used for tracking). This service can then be tracked
by a service tracker which can be used to properly activate all other

To make this easier, Celix provides a basic implementation of a Dependency
Manager (dm).. Basically this manager takes care of tracking and resolving
service dependencies. It provides an additional state model for services
(OSGi already provides a bundle state model). Using the dm it is possible to
add dependencies to components (required and/or unrequired). For required
dependencies the dm blocks activation of the component until they are all

The whiteboard/tracker_depman uses the dm, and provides an example on how to
use it yourself.


Met vriendelijke groet,

Alexander Broekhuis

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message