cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicola Ken Barozzi" <baro...@nicolaken.com>
Subject Refactoring and correction of error notification
Date Thu, 27 Dec 2001 15:38:50 GMT
Attatched is a first release of a possible patch to Cocoon HEAD for the
correction of the error notification stuff.

I've not yet submitted it as a patch because there are some minor problems
that I still need to solve before releasing it as such.

This patch contains code and suggestions from Peter Royal whom I thank for
the valuable and kind cooperation.

What has been done:
1- Changed the names of the classes to be more clear; for example
    Notificable becomes Notifying (that notifies), Notification becomes
   SimpleNotifyingBean and ErrorNotifier becomes NotifyingGenerator.
2- Refactored the error notification classes to fit under
   components.notification and separated the code that builds a Notifying
   object from the SimpleNotifyingBean for max flexibility:
   (Default)NotifyingBuilder, that is also an Avalon component. In this way
   you can filter your errors without touching the Notification DTD or
   creating  custom Generators.
3- Added to the objectModel (in sitemap.xsl) from the beginning of
   processing a NotifyingObjects object that can contain any Notifying
   object  that any component in the sitemap wants to add to it. In this way
   warnings (from Xalan or Xerces 4 example) can be appended to this and
   reported at the end with a notifications-view.
4- Deprecated special method in AbstractEventPipeline for ErrorNotifier; now
   the Notification is gotten from the objectmodel.
5- As a direct consequence of point 3 now Actions put in the handle-errors
   sitemap can get the NotifyingObjects and act on those; many times
   requested for error reporting to admins.
6- Last, but not least, any Exception that is alse Notifying gets notified
   using Notifying methods by the DefaultNotifyingBuilder.

The DTD of the notification is the same and Notifying is almost identical to
Notificable (a HashMap became a Map). Old classes and methods have been
deprecated.

The points that I need to resolve before submitting the patch are:
I - should Constants.NOTIFYING_OBJECTS be put in the objectmodel and created
   there instead of in the sitemap?
II - How come the handle-error pipeline works only after some
   time/invocations? The logs say that:

DEBUG   (2001-12-27) 14:57.21:537   [core    ] (/cocoon/generror)
HttpProcessor[8080][3]/ExcaliburComponentManager: Could not find component
for role: org.apache.cocoon.generation.GeneratorSelector
ERROR   (2001-12-27) 14:57.21:537   [core    ] (/cocoon/generror)
HttpProcessor[8080][3]/sitemap_xmap: NotifyingGenerator was not able to
notify the exception.
org.apache.avalon.framework.component.ComponentException: Could not find
component
 at
org.apache.avalon.excalibur.component.ExcaliburComponentManager.lookup(Excal
iburComponentManager.java:318)
 at
org.apache.cocoon.components.pipeline.AbstractEventPipeline.setGenerator(Abs
tractEventPipeline.java:97)
 at
org.apache.cocoon.components.pipeline.CachingEventPipeline.setGenerator(Cach
ingEventPipeline.java:75)
 at
org.apache.cocoon.www.sitemap_xmap.error_process_9_500(sitemap_xmap.java:932
9)
 at org.apache.cocoon.www.sitemap_xmap.process(sitemap_xmap.java:3285)

   After some invocations/time it cutely says:

DEBUG   (2001-12-27) 14:58.14:973   [core    ] (/cocoon/generror)
HttpProcessor[8080][4]/ExcaliburComponentManager: Could not find component
for role: org.apache.cocoon.generation.GeneratorSelector
DEBUG   (2001-12-27) 14:58.14:973   [core    ] (/cocoon/generror)
HttpProcessor[8080][4]/ExcaliburComponentManager: The Role Manager has not
been set!
DEBUG   (2001-12-27) 14:58.14:973   [core    ] (/cocoon/generror)
HttpProcessor[8080][4]/AbstractEventPipeline: New GS
org.apache.cocoon.sitemap.SitemapComponentSelector@24c22b
DEBUG   (2001-12-27) 14:58.14:973   [core    ] (/cocoon/generror)
HttpProcessor[8080][4]/ExcaliburComponentManager: The Role Manager has not
been set!
DEBUG   (2001-12-27) 14:58.14:973   [core    ] (/cocoon/generror)
HttpProcessor[8080][4]/LogKitLogger: Retrieving a
org.apache.cocoon.sitemap.NotifyingGenerator from the pool
DEBUG   (2001-12-27) 14:58.14:973   [core    ] (/cocoon/generror)
HttpProcessor[8080][4]/AbstractEventPipeline:
!NG!org.apache.cocoon.sitemap.NotifyingGenerator@392fe8

   Then all works perfectly.
   Does this have something to do with the Recomposable stuff?
   Suggestions?
III- I would prefer to add the special NotifyingGenerator
   (ex-ErrorNotifier) to the sitemap in sitemap.roles instead
   of doing it in code in the sitemap.
   I've put tentative code in it (now commented) that doesn't work.
   Does this have something to do with the Recomposable stuff?
   Suggestions?

Things that I will do when this is approved:
a- create a <notify:xxx> XSP taglib, for reporting errors or setting
   notifictions in the objectmodel.
b- create a NotifyingBuilder that filters error messages and enhances them
   using a Resource Bundle (taken also from faqs?).
c- make a notifications-view to see if non-error notifications were issued
d- documentation

Finally, I've read the Constitution and [VOTE]s must be called by active
developers. Being a developer, I humbly suggest that an active developer
asks for a [VOTE] on this issue, being it a refactoring effort that
touches the objectmodel and maybe Environment.

Thank you.
Nicola Ken Barozzi

--
Nicola Ken Barozzi                 xml-cocoon@nicolaken.com

These are the days of miracle and wonder...
          ...so don't cry baby, don't cry...
                                                  Paul Simon

Mime
View raw message