ops4j/peaberry

Integration between the Activation bundle and the GuiceExtensionFactory

mcculls opened this issue · 4 comments

Originally reported on Google Code with ID 55

The Activation bundle and the GuiceExtensionFactory seem to make a
perfect pair for developing Eclipse RCP applications. You don't have
to write any bootstrap code and may use osgi Declarative Services (DS)
without any additional efforts.

After I played around with this scenario for a few hours, I noticed
that the GuiceExtensionFactory creates a new Injector for each module,
even if an
Injector has already been created for that bundle. I don't think that
this makes any sense because the scope of a singletons belongs to it's
Injector (Singletons are created multiple times, one for each Injector).

I noticed that the Spring guys found a nice solution to this by using
an ServiceTracker to retrieve the existing applicationContext from the
osgi environment. If there is any Interest, I could provide a patch
for this. (*http://tinyurl.com/5sgzhxw)*

Are there any upcoming releases? Or has the development been stopped
because auf E4's DI support?

Reported by matzepfau on 2011-03-04 19:58:39

I don't quite understand why do you need to use OSGi DS together with Peaberry. Just
Peaberry is sufficient to handle dynamic services and IMO in a better way than OSGi
DS.

Reported by Rinsvind on 2011-03-07 08:50:33

Sorry for not being clear enough on this. I use Peaberry for exporting OSGi DS.

This problem ist just, that the GuiceExtensionFactory is creating it's own Injector,
even if an Injector has already been created for the bundle.

Reported by matzepfau on 2011-03-07 11:19:09

I've been gradually moving peaberry's OSGi functionality over to our new JSR330 based
container "sisu-inject" which is already used in Maven3 and Nexus (https://github.com/sonatype/sisu).
Sisu (when run in OSGi mode) uses a service listener to track bundle injectors to avoid
duplicates. The equivalent GuiceExtensionFactory is not fully functional yet (full
OSGi support is scheduled for the upcoming 2.3.0 release) but the basics are in place.

So while my focus at the moment (and the foreseeable future) is on "sisu-inject", if
you want to patch peaberry to fix this particular problem then I'm happy to merge it
in and roll out a new release.

Reported by mcculls on 2011-03-07 14:55:41

Reported by mcculls on 2012-08-04 21:41:59

  • Labels added: Peaberry-Extension