Simone Gianni wrote: > Hi Carsten, > if you use a java listener (in all cocoon forms, not just for > ProcessingPhaseListener) the class > o.a.c.forms.event.impl.JavaClassWidgetListenerBuilder is responsible for > setting it up. If calls a LyfecycleHelper..setupComponent(listener, > null, null, manager, null); > > AFAIK, since only the instance and the manager are passed in, i suppose > that if you implement Configurable in your java class you will not > obtain a valid Configuration object. > > It should not be difficult (since the w3c Element is available) to pass > is wrapped in a Configuration to the LifecycleHelper ... trying right now. > > Ok, in JavaClassWidgetBuilder is should be enought to add the > Configuration conf = ConfigurationUtil.toConfiguration(element); line > and then pass it to the LifecycleHelper. > > Line 54 : > Object listener = ClassUtils.newInstance(name); > if (listenerClass.isAssignableFrom(listener.getClass())) { > Configuration conf = ConfigurationUtil.toConfiguration(element); > LifecycleHelper.setupComponent(listener, null, null, > manager, conf); > return (WidgetListener)listener; > > Don't have time right now to test and eventually commit this, but it's > worth doing it : it will enable every java listener to implement the > Configurable interface and receive configuration from the definition. > Will have time to do this this evening, unless you do it before me :) > Thanks for the info, Simone, I add the code and also added support for LogEnabled and Contextualizable, so a listener can now be a full Avalon component :) I haven't tested it yet....
Carsten -- Carsten Ziegeler - Open Source Group, S&N AG http://www.s-und-n.de http://www.osoco.org/weblogs/rael/