You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Martin Thelian <Ma...@gmx.at> on 2008/10/30 07:42:33 UTC

Listen for appearance of class in bundle classpath

Hi,

in my project I have some bundles providing mandatory and optional 
services, whereas the optional services are depending on java-packages 
imported with resolution:=optional. E.g. a servlet capable to generate 
charts if a bundle containing JFreeChart is installed.

What is the best way to register such a service once a required class 
appears in the bundle classpath?

Thanks.
Regards,
Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Listen for appearance of class in bundle classpath

Posted by Karl Pauls <ka...@gmail.com>.
Well, if you use resolution:=optional then either your bundle is wired
to a provider on start or it isn't -- hence, you only need to check
when the bundle is started whether a class from that package is
available to you or not and if it is then just register you service.

In case what you want to do is to allow your bundle to get wired to
the package of a bundle installed after your bundle has been already
started you will have to use a DynamicImport-Package. In that case you
can then do the same check on bundle startup and everytime a bundle
gets installed (using a BundleListener) until you get wired to a
provider. Then make your service available.

regards,

Karl

On Thu, Oct 30, 2008 at 7:42 AM, Martin Thelian <Ma...@gmx.at> wrote:
> Hi,
>
> in my project I have some bundles providing mandatory and optional services,
> whereas the optional services are depending on java-packages imported with
> resolution:=optional. E.g. a servlet capable to generate charts if a bundle
> containing JFreeChart is installed.
>
> What is the best way to register such a service once a required class
> appears in the bundle classpath?
>
> Thanks.
> Regards,
> Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>



-- 
Karl Pauls
karlpauls@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org