Author: jeremias
Date: Tue Feb  5 08:12:56 2008
New Revision: 618686

URL: http://svn.apache.org/viewvc?rev=618686&view=rev
Log:
Hooked most of FONode into the new event mechanism. The FOUserAgent provides a 
DefaultEventBroadcaster instance.
If a producer method declares throwing an exception, the event is automatically 
marked FATAL and the dynamic proxy throws an exception right after notifying 
the listeners.
The exceptions are created through the EventExceptionManager. It currently 
contains only one exception factory for ValidationException. If we need more 
such factories it's better to register them dynamically. Right now, they're 
hard-coded.

Added:
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventExceptionManager.java
   (with props)
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter_de.xml
   (with props)
Modified:
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/codegen/java/org/apache/fop/tools/EventProducerCollector.java
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/apps/FOUserAgent.java
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/DefaultEventBroadcaster.java
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter.java
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter.xml
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/model/EventMethodModel.java
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/model/EventModelParser.java
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FONode.java
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOValidationEventProducer.java

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/codegen/java/org/apache/fop/tools/EventProducerCollector.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/codegen/java/org/apache/fop/tools/EventProducerCollector.java?rev=618686&r1=618685&r2=618686&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/codegen/java/org/apache/fop/tools/EventProducerCollector.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/codegen/java/org/apache/fop/tools/EventProducerCollector.java
 Tue Feb  5 08:12:56 2008
@@ -144,6 +144,13 @@
                     methodMeta.addParameter(type, p.getName());
                 }
             }
+            Type[] exceptions = method.getExceptions();
+            if (exceptions != null && exceptions.length > 0) {
+                //We only use the first declared exception because that is 
always thrown
+                JavaClass cl = exceptions[0].getJavaClass();
+                methodMeta.setExceptionClass(cl.getFullyQualifiedName());
+                methodMeta.setSeverity(EventSeverity.FATAL); //In case it's 
not set in the comments
+            }
             prodMeta.addMethod(methodMeta);
         }
         this.model.addProducer(prodMeta);

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/apps/FOUserAgent.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/apps/FOUserAgent.java?rev=618686&r1=618685&r2=618686&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/apps/FOUserAgent.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/apps/FOUserAgent.java
 Tue Feb  5 08:12:56 2008
@@ -36,6 +36,8 @@
 import org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext;
 
 import org.apache.fop.Version;
+import org.apache.fop.events.DefaultEventBroadcaster;
+import org.apache.fop.events.EventBroadcaster;
 import org.apache.fop.fo.FOEventHandler;
 import org.apache.fop.pdf.PDFEncryptionParams;
 import org.apache.fop.render.Renderer;
@@ -90,6 +92,7 @@
     private Renderer rendererOverride = null;
     private FOEventHandler foEventHandlerOverride = null;
     private boolean locatorEnabled = true; // true by default (for error 
messages).
+    private EventBroadcaster eventBroadcaster = new DefaultEventBroadcaster();
     
     /** Producer:  Metadata element for the system/software that produces
      * the document. (Some renderers can store this in the document.)
@@ -562,6 +565,16 @@
      */
     public boolean isLocatorEnabled() {
         return locatorEnabled;
+    }
+
+    /**
+     * Returns the event broadcaster that control events sent inside a 
processing run. Clients
+     * can register event listeners with the event broadcaster to listen for 
events that occur
+     * while a document is being processed.
+     * @return the event broadcaster.
+     */
+    public EventBroadcaster getEventBroadcaster() {
+        return this.eventBroadcaster;
     }
 
 }

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/DefaultEventBroadcaster.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/DefaultEventBroadcaster.java?rev=618686&r1=618685&r2=618686&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/DefaultEventBroadcaster.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/DefaultEventBroadcaster.java
 Tue Feb  5 08:12:56 2008
@@ -37,6 +37,7 @@
 import org.apache.fop.events.model.EventModel;
 import org.apache.fop.events.model.EventModelParser;
 import org.apache.fop.events.model.EventProducerModel;
+import org.apache.fop.events.model.EventSeverity;
 
 public class DefaultEventBroadcaster implements EventBroadcaster {
 
@@ -138,6 +139,10 @@
                         }
                         Event ev = new Event(args[0], eventID, 
methodModel.getSeverity(), params);
                         broadcastEvent(ev);
+                        if (methodModel.getSeverity() == EventSeverity.FATAL) {
+                            EventExceptionManager.throwException(ev,
+                                    methodModel.getExceptionClass());
+                        }
                         return null;
                     }
                 });

Added: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventExceptionManager.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventExceptionManager.java?rev=618686&view=auto
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventExceptionManager.java
 (added)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventExceptionManager.java
 Tue Feb  5 08:12:56 2008
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.events;
+
+import java.util.Locale;
+import java.util.Map;
+
+import org.xml.sax.Locator;
+
+import org.apache.fop.fo.ValidationException;
+
+/**
+ * This class is reponsible for converting events into exceptions.
+ */
+public class EventExceptionManager {
+
+    private static final Map EXCEPTION_FACTORIES = new java.util.HashMap();
+    
+    static {
+        //TODO Replace with dynamic registration if more than two different 
exceptions are needed.
+        EXCEPTION_FACTORIES.put(ValidationException.class.getName(),
+                new ValidationExceptionFactory());
+    }
+    
+    /**
+     * Converts an event into an exception and throws that.
+     * @param event the event to be converted
+     * @param exceptionClass the exception class to be thrown
+     * @throws Throwable this happens always
+     */
+    public static void throwException(Event event, String exceptionClass) 
throws Throwable {
+        
+        //TODO Localize exceptions!
+        //TODO Complain if there's no ExceptionFactory for the given 
exceptionClass
+        
+        ExceptionFactory factory = 
(ExceptionFactory)EXCEPTION_FACTORIES.get(exceptionClass);
+        if (factory != null) {
+            throw factory.createException(event);
+        } else {
+            String msg = EventFormatter.format(event);
+            throw new RuntimeException(msg);
+        }
+    }
+    
+    private interface ExceptionFactory {
+        Throwable createException(Event event);
+    }
+    
+    private static class ValidationExceptionFactory implements 
ExceptionFactory {
+
+        public Throwable createException(Event event) {
+            Locator loc = (Locator)event.getParam("loc");
+            String msg = EventFormatter.format(event, Locale.ENGLISH);
+            ValidationException ex = new ValidationException(msg, loc);
+            return ex;
+        }
+        
+    }
+}

Propchange: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventExceptionManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventExceptionManager.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter.java?rev=618686&r1=618685&r2=618686&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter.java
 Tue Feb  5 08:12:56 2008
@@ -19,6 +19,7 @@
 
 package org.apache.fop.events;
 
+import java.util.Locale;
 import java.util.ResourceBundle;
 
 import org.apache.fop.util.AdvancedMessageFormat;
@@ -36,7 +37,15 @@
         return format(event, defaultBundle);
     }
     
-    public static String format(Event event, ResourceBundle bundle) {
+    public static String format(Event event, Locale locale) {
+        ResourceBundle bundle = XMLResourceBundle.getXMLBundle(
+                EventFormatter.class.getName(),
+                locale,
+                EventFormatter.class.getClassLoader());
+        return format(event, bundle);
+    }
+
+    private static String format(Event event, ResourceBundle bundle) {
         String template = bundle.getString(event.getEventID());
         return format(event, template);
     }

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter.xml
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter.xml?rev=618686&r1=618685&r2=618686&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter.xml
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter.xml
 Tue Feb  5 08:12:56 2008
@@ -17,5 +17,10 @@
 -->
 <!-- $Id$ -->
 <catalogue xml:lang="en">
-  <message 
key="org.apache.fop.fo.FOValidationEventProducer.missingProperty">Element 
"{elementName}" is missing required property "{propertyName}"!</message>
+    <message 
key="org.apache.fop.fo.FOValidationEventProducer.tooManyNodes">For 
"{elementName}", only one "{offendingNode}" may be declared.[ See position 
{loc}.]</message>
+    <message 
key="org.apache.fop.fo.FOValidationEventProducer.nodeOutOfOrder">For 
"{elementName}", "{tooLateNode}" must be declared before "{tooEarlyNode}"![ See 
position {loc}.]</message>
+    <message 
key="org.apache.fop.fo.FOValidationEventProducer.invalidChild">"{offendingNode}"
 is not a valid child element of "{elementName}"![ {ruleViolated}][ See 
position {loc}.]</message>
+    <message 
key="org.apache.fop.fo.FOValidationEventProducer.missingChildElement">"{elementName}"
 is missing child elements.
+Required content model: {contentModel}[ See position {loc}.]</message>
+    <message 
key="org.apache.fop.fo.FOValidationEventProducer.missingProperty">Element 
"{elementName}" is missing required property "{propertyName}"![ See position 
{loc}.]</message>
 </catalogue>

Added: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter_de.xml
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter_de.xml?rev=618686&view=auto
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter_de.xml
 (added)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter_de.xml
 Tue Feb  5 08:12:56 2008
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+    
+    http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<!-- $Id$ -->
+<catalogue xml:lang="de">
+  <message key="org.apache.fop.fo.FOValidationEventProducer.tooManyNodes">In 
"{elementName}" darf nur ein einziges "{offendingNode}" vorkommen![ Siehe 
Position {loc}]</message>
+  <message 
key="org.apache.fop.fo.FOValidationEventProducer.missingProperty">Dem Element 
"{elementName}" fehlt ein verlangtes Property "{propertyName}"![ Siehe Position 
{loc}]</message>
+</catalogue>

Propchange: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter_de.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/model/EventMethodModel.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/model/EventMethodModel.java?rev=618686&r1=618685&r2=618686&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/model/EventMethodModel.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/model/EventMethodModel.java
 Tue Feb  5 08:12:56 2008
@@ -35,6 +35,7 @@
     private String methodName;
     private EventSeverity severity;
     private List params = new java.util.ArrayList();
+    private String exceptionClass;
     
     public EventMethodModel(String methodName, EventSeverity severity) {
         this.methodName = methodName;
@@ -71,11 +72,22 @@
         return Collections.unmodifiableList(this.params);
     }
     
+    public void setExceptionClass(String exceptionClass) {
+        this.exceptionClass = exceptionClass;
+    }
+    
+    public String getExceptionClass() {
+        return this.exceptionClass;
+    }
+    
     /** [EMAIL PROTECTED] */
     public void toSAX(ContentHandler handler) throws SAXException {
         AttributesImpl atts = new AttributesImpl();
         atts.addAttribute(null, "name", "name", "CDATA", getMethodName());
         atts.addAttribute(null, "severity", "severity", "CDATA", 
getSeverity().getName());
+        if (getExceptionClass() != null) {
+            atts.addAttribute(null, "exception", "exception", "CDATA", 
getExceptionClass());
+        }
         String elName = "method";
         handler.startElement(null, elName, elName, atts);
         Iterator iter = this.params.iterator();

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/model/EventModelParser.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/model/EventModelParser.java?rev=618686&r1=618685&r2=618686&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/model/EventModelParser.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/model/EventModelParser.java
 Tue Feb  5 08:12:56 2008
@@ -102,8 +102,12 @@
                     objectStack.push(producer);
                 } else if ("method".equals(localName)) {
                     EventSeverity severity = 
EventSeverity.valueOf(attributes.getValue("severity"));
+                    String ex = attributes.getValue("exception");
                     EventMethodModel method = new EventMethodModel(
                             attributes.getValue("name"), severity);
+                    if (ex != null && ex.length() > 0) {
+                        method.setExceptionClass(ex);
+                    }
                     EventProducerModel parent = 
(EventProducerModel)objectStack.peek();
                     parent.addMethod(method);
                     objectStack.push(method);

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FONode.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FONode.java?rev=618686&r1=618685&r2=618686&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FONode.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FONode.java
 Tue Feb  5 08:12:56 2008
@@ -21,6 +21,7 @@
 
 // Java
 import java.util.ListIterator;
+import java.util.NoSuchElementException;
 
 import org.xml.sax.Attributes;
 import org.xml.sax.Locator;
@@ -29,6 +30,8 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import org.apache.xmlgraphics.util.QName;
+
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.fo.extensions.ExtensionAttachment;
@@ -374,23 +377,34 @@
      */
     protected void tooManyNodesError(Locator loc, String nsURI, String lName) 
                 throws ValidationException {
-        throw new ValidationException(errorText(loc) + "For " + getName() 
-            + ", only one " + getNodeString(nsURI, lName) + " may be 
declared.", 
-            loc);
+        tooManyNodesError(loc, new QName(nsURI, lName));
     }
 
     /**
      * Helper function to standardize "too many" error exceptions
      * (e.g., two fo:declarations within fo:root)
-     * This overrloaded method helps make the caller code better 
self-documenting
+     * @param loc org.xml.sax.Locator object of the error (*not* parent node)
+     * @param offendingNode the qualified name of the offending node
+     * @throws ValidationException the validation error provoked by the method 
call
+     */
+    protected void tooManyNodesError(Locator loc, QName offendingNode) 
+                throws ValidationException {
+        FOValidationEventProducer producer = 
FOValidationEventProducer.Factory.create(
+                getUserAgent().getEventBroadcaster());
+        producer.tooManyNodes(this, getName(), offendingNode, loc);
+    }
+
+    /**
+     * Helper function to standardize "too many" error exceptions
+     * (e.g., two fo:declarations within fo:root)
+     * This overloaded method helps make the caller code better 
self-documenting
      * @param loc org.xml.sax.Locator object of the error (*not* parent node)
      * @param offendingNode incoming node that would cause a duplication.
      * @throws ValidationException the validation error provoked by the method 
call
      */
     protected void tooManyNodesError(Locator loc, String offendingNode) 
                 throws ValidationException {
-        throw new ValidationException(errorText(loc) + "For " + getName() 
-            + ", only one " + offendingNode + " may be declared.", loc);
+        tooManyNodesError(loc, new QName(FO_URI, offendingNode));
     }
 
     /**
@@ -402,9 +416,10 @@
      * @throws ValidationException the validation error provoked by the method 
call
      */
     protected void nodesOutOfOrderError(Locator loc, String tooLateNode, 
-        String tooEarlyNode) throws ValidationException {
-        throw new ValidationException(errorText(loc) + "For " + getName() + ", 
" + tooLateNode 
-            + " must be declared before " + tooEarlyNode + ".", loc);
+            String tooEarlyNode) throws ValidationException {
+        FOValidationEventProducer producer = 
FOValidationEventProducer.Factory.create(
+                getUserAgent().getEventBroadcaster());
+        producer.nodeOutOfOrder(this, getName(), tooLateNode, tooEarlyNode, 
loc);
     }
     
     /**
@@ -432,9 +447,10 @@
     protected void invalidChildError(Locator loc, String nsURI, String lName,
                 String ruleViolated)
                 throws ValidationException {
-        throw new ValidationException(errorText(loc) + getNodeString(nsURI, 
lName) 
-            + " is not a valid child element of " + getName() 
-            + ((ruleViolated != null) ? ": " + ruleViolated : "."), loc);
+        FOValidationEventProducer producer = 
FOValidationEventProducer.Factory.create(
+                getUserAgent().getEventBroadcaster());
+        //TODO Localize ruleViolated somehow!
+        producer.invalidChild(this, getName(), new QName(nsURI, lName), 
ruleViolated, loc);
     }
 
     /**
@@ -446,9 +462,9 @@
      */
     protected void missingChildElementError(String contentModel)
                 throws ValidationException {
-        throw new ValidationException(errorText(locator) + getName() 
-            + " is missing child elements. \nRequired Content Model: " 
-            + contentModel, locator);
+        FOValidationEventProducer producer = 
FOValidationEventProducer.Factory.create(
+                getUserAgent().getEventBroadcaster());
+        producer.missingChildElement(this, getName(), contentModel, locator);
     }
 
     /**
@@ -458,8 +474,9 @@
      */
     protected void missingPropertyError(String propertyName)
                 throws ValidationException {
-        throw new ValidationException(errorText(locator) + getName()
-            + " is missing required \"" + propertyName + "\" property.", 
locator);
+        FOValidationEventProducer producer = 
FOValidationEventProducer.Factory.create(
+                getUserAgent().getEventBroadcaster());
+        producer.missingProperty(this, getName(), propertyName, locator);
     }
 
     /**

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOValidationEventProducer.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOValidationEventProducer.java?rev=618686&r1=618685&r2=618686&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOValidationEventProducer.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOValidationEventProducer.java
 Tue Feb  5 08:12:56 2008
@@ -19,17 +19,62 @@
 
 package org.apache.fop.fo;
 
+import org.xml.sax.Locator;
+
+import org.apache.xmlgraphics.util.QName;
+
+import org.apache.fop.events.EventBroadcaster;
 import org.apache.fop.events.EventProducer;
 
 public interface FOValidationEventProducer extends EventProducer {
 
     /**
-     * Express joy about something.
+     * Too many child nodes.
+     * @param source
+     * @param source the event source
+     * @param elementName the name of the context node
+     * @param offendingNode the offending node
+     * @param loc the location of the error or null
+     * @event.severity FATAL
+     */
+    void tooManyNodes(Object source, String elementName, QName offendingNode,
+            Locator loc) throws ValidationException;
+    
+    void nodeOutOfOrder(Object source, String elementName, String tooLateNode, 
String tooEarlyNode,
+            Locator loc) throws ValidationException;
+    
+    void invalidChild(Object source, String elementName, QName offendingNode, 
String ruleViolated,
+            Locator loc) throws ValidationException;
+
+    void missingChildElement(Object source, String elementName, String 
contentModel,
+            Locator locator) throws ValidationException;
+
+    /**
+     * An element is missing a required property.
      * @param source the event source
-     * @param node the context node
      * @param elementName the name of the context node
      * @param propertyName the name of the missing property
      * @event.severity FATAL
      */
-    void missingProperty(Object source, FONode node, String elementName, 
String propertyName);
+    void missingProperty(Object source, String elementName, String 
propertyName,
+            Locator loc) throws ValidationException;
+    
+    /**
+     * Factory class for the event producer.
+     */
+    public class Factory {
+        
+        /**
+         * Creates a new event producer.
+         * @param broadcaster the event broadcaster to use
+         * @return the new event producer
+         */
+        public static FOValidationEventProducer create(EventBroadcaster 
broadcaster) {
+            return (FOValidationEventProducer)broadcaster.getEventProducerFor(
+                    FOValidationEventProducer.class);
+        }
+    }
+
+
+    
 }



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

Reply via email to