Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sisu-users] Sisu in OSGi


First of all,

thank you very much for your detailed answers.

> No worries, I'm working on updating the FAQ at the moment so this is
> actually very timely :)


Good to know, I have a few more questions :-)

> The example extender bundle uses Sisu to scan bundles for components
> as they are started:

>
>     https://github.com/eclipse/sisu.inject/blob/master/org.eclipse.
> sisu.inject.
> extender/src/org/eclipse/sisu/launch/internal/SisuActivator.java#L113


I had a look at the source code and made some simple tests with a chain of two bundles, and everything worked like magic :-)
If I understood correctly, the extender instantiates multiple Provider<Injector> objects that will be all registered into the DefaultBeanLocator. The additional registration in the OSGi service using the extended bundle bundlecontext is only used to perform proper removal from the DefaultBeanLocator when the owning bundle goes offline.

Not related to Sisu, but I noticed that the SisuActivator uses a WeakReference to the DefaultBeanLocator. Is that used for supporting a bundle update/refresh ?

>     *  extend dynamic updates to apply to injected instances, not
> just injected collections (https://bugs.eclipse.org/bugs/show_bug.
> cgi?id=386430)


The above bugzilla entry states that injected lists and maps are already supported. Does it refer to Guice MultiBindings (http://code.google.com/p/google-guice/wiki/Multibindings) or what ?
Also, when classes are found via scanning, what happens when multiple implementations of the same interface exist? Does Sisu automatically create a Guice multibinding ?

Does Sisu support Guice's chained linked bindings (http://code.google.com/p/google-guice/wiki/LinkedBindings)?
I am asking because my application comes with default implementation of certain interfaces and base classes, but we need a simple way of letting developers override them with custom implementations. Ideally such overrides would be implemented in an extra OSGi bundle to be included in the final application distribution. Would a simple Guice module implemented in the extra bundle and declared in META-INF/services/com.google.inject.Module work?

And now my last question, at least for today :-). My application is using the OSGi extender pattern for collecting metadata about classes included in its bundles. If I wanted our extender to create a guice module on-the-fly to bind those classes, I believe I could mimic the behaviour of the BundleInjector class that is included in the Sisu extender. Is that right? I would need to refactor the Sisu extender to make some code more reusable, and then have my extender create additional BundleInjectors when appropriate. Would it be an issue for Sisu if more than one BundleInjector exist for the same bundle?

Thanks in advance.
GianMaria Romanato.

Back to the top