cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Ziegeler <cziege...@apache.org>
Subject [RT] Sitemap Listeners
Date Fri, 15 Apr 2005 14:07:15 GMT
I while ago we briefly discussed the idea of sitemap listeners that are
invoked each time a sitemap is entered/left.

Our 2.2 code base contains a first implementation which can be seen as a
very simple base for this feature. I think it's time now to discuss this
further.

1. Configuration

You can define listeners in the map:components section in a sitemap with:
<map:listeners>
  <map:listener role="Some Avalon role"/>
  <map:listener class="A class"/>
</map:listeners>

So you can either use a configured component or define a class and then
an instance of this class is created (using the per sitemap
classloader). In both cases the listener must be thread safe.

2. Listeners and Events

Currently there are two listener types defined (in o.a.c.sitemap):

public interface EnterSitemapEventListener extends SitemapListener {

    void enteredSitemap(EnterSitemapEvent event);
}
public interface LeaveSitemapEventListener extends SitemapListener {

    void leftSitemap(LeaveSitemapEvent event);
}

the events currently only contain the Processor (= Sitemap) and the
current Environment.

3. Listener Invocation

Each EnterSitemapEventListener is invoked for each request entering a
sitemap and of course the LeaveSitemapEventListener each time a request
leaves a sitemap. There is no distinction between internal and external
processing yet: in the case of internal processing, the listeners are
invoked during the construction phase.


The listener interfaces need some more information, like if a request
was handled by this sitemap, if an error occured etc. and we should
define when the listeners are invoked, especially for internal requests.

WDYT?

BTW, I'm using the listeners in the spring-app block to store the
current application context (the per sitemap context) in a request
attribute.

Carsten

-- 
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/

Mime
View raw message