Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sisu-dev] Bundle fragment-based extension

On 31 Oct 2012, at 06:30, Don Brown wrote:

There are a number of places that I'd like to extend or customize sisu, like hooking into the bean scanning [1] or add new default modules [2], but right now, there is no way to do that.

Yes one of the goals of the roadmap is to let people customize and hook into various steps, such as scanning, etc. Part of this involves defining a clear SPI so it's clear what can be customized.

  Spring DM uses a bundle fragment to allow you to add new XML files to the configuration to either add or override key behaviors, so I'm wondering if we could do the same thing here?

A couple ideas:
1. Turn the scanner on ourselves in a subpackage like sisu.extensions.  This would work as bundle fragment classes are treated as local bundle classes.
2. Have a custom XML or YAML file that describes how the fragment wants to plug in, for example:
   <sisu-extension>
     <default-module>org.company.MyDefaultModule</default-module>
     <scanner>org.company.MyBeanScanner</scanner>
   </sisu-extension>

I like #1 the most, as it keeps things Guice-like and partial bundle scanning would be useful elsewhere.

We can use a directed scanner approach, the current scanner when running in indexed mode uses a simple file under META-INF/sisu that lists components to scan (saves the expensive search of the classpath while still allowing flexibility in scanning). Right now named components (ie. those with some kind of indentity) are listed under "META-INF/sisu/javax.inject.Named", we could list extensions under a different filename which would then keep them from getting mixed up with non-extension components.

Thanks for the feature requests - this is all good stuff.

Don

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=393213
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=393214
_______________________________________________
sisu-dev mailing list
sisu-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/sisu-dev


Back to the top