I think it can not work with a simple optional import. What could work is a
separate component that has
the optional class as a mandatory reference.

This component could then be injected into your component with an optional
reference and with an interface that is independent of the optional import.

I think declarative services do not yet support this but it would be a very
valuable feature as it allows to handle optional imports without any class
loading magic on the user side.

Christian

2017-11-21 14:53 GMT+01:00 Robert Munteanu via osgi-dev <
[email protected]>:

> Hi Carsten,
>
> On Tue, Nov 21, 2017 at 3:50 PM, Carsten Ziegeler <[email protected]>
> wrote:
> > Hi,
> >
> > if I understand you correctly you have an optional package import to the
> > package providing BarService?
>
> Yes, that is correct.
>
> > In that case your class SomeComponent can't be loaded if that package is
> > not available and there is no magic to get around this.
>
> I was afraid of that. I'll try using a ServiceTracker, guess that's
> the next best thing.
>
> Thanks,
>
> Robert
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> https://mail.osgi.org/mailman/listinfo/osgi-dev
>



-- 
-- 
Christian Schneider
http://www.liquid-reality.de
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>

Computer Scientist
http://www.adobe.com
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to