2009/4/15 Alan D. Cabrera <[email protected]>

> After reading the core spec it seems that if I look for service using the
> system bundle context, I will never be able to find any application specific
> service.  Let me explain my reasoning and maybe someone can show me where my
> disconnect is occurring.
>
> Upon reading the definition of the getServiceReferences() method I see that
> isAssignableTo() must be called with all the service interfaces and the
> bundle that is being used to perform the "call" to getServiceReferences().
>
> It seems to me that if I pass the system bundle to isAssignableTo() I will
> get false for just about all the application specific service interfaces.
>
> If that is true then it seems that I will not be able to retrieve most
> service references with the system bundle.
>

yes - a bundle calling getServiceReferences() will only get back services
whose
interfaces are visible to the calling bundle (this is to avoid class cast
exceptions
when casting the service object to the required interface)

if you want to skip this check use getAllServiceReferences() which will
return all
matching services without the compatibility check (you can still use a
filter, etc.)

also note that service interfaces on the main classpath can be exposed via
the
system bundle using "org.osgi.framework.system.packages.extra", in which
case
both the system bundle and service implementor(s) can see the same interface
and therefore such services would then be visible to the system bundle

Am I correct?
>
>
> Regards,
> Alan
>
>
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> https://mail.osgi.org/mailman/listinfo/osgi-dev
>



-- 
Cheers, Stuart
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to