Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sisu-dev] EntryListAdapter and notifications

Hi,

I am using Sisu 0.2 in an OSGi application and I am happily taking advantage of its capability of injecting components into dynamic lists that get updated by Sisu as bundles come and go.

The more we use Sisu, the happier we are with it, at a point that we are considering using it for some of the responsibilities that for historical reasons were delegated to the Equinox Registry, which is also used in my application.

For example, the Equinox Registry was often used to be able to contribute configuration pieces that are subject to the bundle lifecycle. In this context everything works fine, but to consume the contributed configuration one has to deal with the IExtensionPoint, IExtension and IConfigurationElement classes of the Equinox Registry API, which remind of low-level XML DOM manipulation.

I can imagine someone to prefer a more object oriented approach: for example, instead of declaring an extension point, one could define an abstract configuration bean. Those who want to contribute to the extension point would just need to subclass the abstract bean, call setters in its default constructor to define the configuration values, and make sure the new class is annotated @Named. At this point the configurable subsystem could just use a @Named List< AbstractConfigurationBean> to be injected with all available configuration beans by Sisu.

There is only one thing that the Equinox Registry would still do better in this case: it's ability to notify change events as items come and go due to their declaring bundle coming and going.

If I am not mistaken, when Sisu injects a list, the list type if EntryListAdapter. Do you think it would make sense to extend it so that it allows to add/remove listeners that get notified when list items are added/removed?

GianMaria.


Back to the top