Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Xmlgraphics-fop Wiki" 
for change notification.

The following page has been changed by JeremiasMaerki:
http://wiki.apache.org/xmlgraphics-fop/ProcessingFeedback

The comment on the change is:
A first minimal approach with no external dependencies

------------------------------------------------------------------------------
  
  ''Comment by JeremiasMaerki: I've removed the point about Java 1.5. You were 
right, of course. I just saw "@"s and thought they were annotations. I took a 
closer look now. A problem for us would be the current necessity for Maven for 
code generation. We'd need an Ant task. I get the impression that the main 
focus is on logging those events to a logging subsystem. For us, I think, this 
would only be a side-show. The most important is for the user to install an 
event listener so all events (including all parameters) can be inspected and 
acted upon (including throwing exceptions). My proposal: I'm going to sketch 
out a proposal (without Blammo) that I think would meet the requirements of FOP 
and then we can see if and how Blammo could maybe accommodate this and if it 
would be worth adding such a dependency.
  
+ == Minimal approach ==
+ 
+ {{{
+ public class FopEvent extends EventObject {
+ 
+     [..]
+ 
+     public FopEvent(Object source, String eventID, Map params) {
+     [..]
+ 
+ }
+ 
+ public interface FopEventListener extends EventListener {
+     void processEvent(FopEvent event);
+ }
+ 
+ 
+ public interface EventBroadcaster {
+     void addFopEventListener(FopEventListener listener);
+     void removeFopEventListener(FopEventListener listener);
+     int getListenerCount();
+     void broadcastEvent(FopEvent event);
+ }
+ }}}
+ 
+ Sample code:
+ 
+ {{{
+     MyEventListener listener = new MyEventListener();
+ 
+     EventBroadcaster broadcaster = new DefaultEventBroadcaster();
+     broadcaster.addFopEventListener(listener);
+ 
+     [..]
+ 
+     public static final String EVENT_MISSING_CHILD_ERROR = 
"missing-child-error";
+ 
+     [..]
+         
+     FopEvent ev = new FopEvent(this, EventConstants.EVENT_MISSING_CHILD_ERROR,
+                 FopEvent.paramsBuilder()
+                     .param("element", this)
+                     .param("elementName", getName())
+                     .param("contentModel", contentModel)
+                     .param("locator", this.locator)
+                     .build());
+     broadcaster.broadcastEvent(ev);
+ }}}
+ 
+ Notes:
+ 
+  * A special !EventListener can be written and plugged-in which creates 
human-readable messages from the event objects that can be logged using the 
default logger.
+  * Message templates would be saves in properties files, accessed by 
!ResourceBundle.
+ 
+ Good:
+ 
+  * Easy to implement, not much infrastructure necessary
+  * No external dependencies
+ 
+ Bad:
+ 
+  * Event production not as nice and clean as with a Java interface
+  * No check mechanisms for detecting missing messages/message translations
+  * No check mechanisms for detecting mismatches between used parameters and 
the parameters that are available
+ 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to