You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by Guillaume Nodet <gn...@gmail.com> on 2010/03/11 13:59:19 UTC

[Blueprint] How to have real optional dependencies

One thing I'm used to when developing bundles in OSGi is to have
really optional dependencies.
For example if the log service is here, use it, else don't.
Using an optional service dependency is usually not sufficient as you
don't want to fail if the package is not available.
The usual trick is to use an optional or dynamic import and a try /
catch (ClassNotFound /  NoClassDefFoundError) while
loading a class.

I think we should be able to mimic this behavior using blueprint, but
there's no simple way currently.
Has anyone already thought about that or has any idea how to achieve
that in a way which is easy for the user ?

The main problem I see is that ClassNotFound will always result in the
bundle not being started if you follow the blueprint spec (or I think
so),
so this would be a blueprint extension I suppose.

-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com