diff options
Diffstat (limited to 'src/java/org/apache/fop/events')
17 files changed, 83 insertions, 83 deletions
diff --git a/src/java/org/apache/fop/events/CompositeEventListener.java b/src/java/org/apache/fop/events/CompositeEventListener.java index a65728b71..2b5cbffb2 100644 --- a/src/java/org/apache/fop/events/CompositeEventListener.java +++ b/src/java/org/apache/fop/events/CompositeEventListener.java @@ -27,7 +27,7 @@ import java.util.List; public class CompositeEventListener implements EventListener { private List listeners = new java.util.ArrayList(); - + /** * Adds an event listener to the broadcaster. It is appended to the list of previously * registered listeners (the order of registration defines the calling order). @@ -49,7 +49,7 @@ public class CompositeEventListener implements EventListener { private synchronized int getListenerCount() { return this.listeners.size(); } - + /** * Indicates whether any listeners have been registered with the broadcaster. * @return true if listeners are present, false otherwise @@ -57,7 +57,7 @@ public class CompositeEventListener implements EventListener { public boolean hasEventListeners() { return (getListenerCount() > 0); } - + /** {@inheritDoc} */ public synchronized void processEvent(Event event) { for (int i = 0, c = getListenerCount(); i < c; i++) { diff --git a/src/java/org/apache/fop/events/DefaultEventBroadcaster.java b/src/java/org/apache/fop/events/DefaultEventBroadcaster.java index bb1752a72..cd415a8d7 100644 --- a/src/java/org/apache/fop/events/DefaultEventBroadcaster.java +++ b/src/java/org/apache/fop/events/DefaultEventBroadcaster.java @@ -42,7 +42,7 @@ public class DefaultEventBroadcaster implements EventBroadcaster { /** Holds all registered event listeners */ protected CompositeEventListener listeners = new CompositeEventListener(); - + /** {@inheritDoc} */ public void addEventListener(EventListener listener) { this.listeners.addEventListener(listener); @@ -57,7 +57,7 @@ public class DefaultEventBroadcaster implements EventBroadcaster { public boolean hasEventListeners() { return this.listeners.hasEventListeners(); } - + /** {@inheritDoc} */ public void broadcastEvent(Event event) { this.listeners.processEvent(event); @@ -65,7 +65,7 @@ public class DefaultEventBroadcaster implements EventBroadcaster { private static List/*<EventModel>*/ eventModels = new java.util.ArrayList(); private Map proxies = new java.util.HashMap(); - + static { Iterator iter = Service.providers(EventModelFactory.class, true); while (iter.hasNext()) { @@ -81,7 +81,7 @@ public class DefaultEventBroadcaster implements EventBroadcaster { public static void addEventModel(EventModel eventModel) { eventModels.add(eventModel); } - + /** {@inheritDoc} */ public EventProducer getEventProducerFor(Class clazz) { if (!EventProducer.class.isAssignableFrom(clazz)) { @@ -97,7 +97,7 @@ public class DefaultEventBroadcaster implements EventBroadcaster { } return producer; } - + private EventProducerModel getEventProducerModel(Class clazz) { for (int i = 0, c = eventModels.size(); i < c; i++) { EventModel eventModel = (EventModel)eventModels.get(i); @@ -108,7 +108,7 @@ public class DefaultEventBroadcaster implements EventBroadcaster { } return null; } - + /** * Creates a dynamic proxy for the given EventProducer interface that will handle the * conversion of the method call into the broadcasting of an event instance. @@ -147,7 +147,7 @@ public class DefaultEventBroadcaster implements EventBroadcaster { } Event ev = new Event(args[0], eventID, methodModel.getSeverity(), params); broadcastEvent(ev); - + if (ev.getSeverity() == EventSeverity.FATAL) { EventExceptionManager.throwException(ev, methodModel.getExceptionClass()); @@ -156,5 +156,5 @@ public class DefaultEventBroadcaster implements EventBroadcaster { } }); } - + } diff --git a/src/java/org/apache/fop/events/Event.java b/src/java/org/apache/fop/events/Event.java index d3da1809e..e820db995 100644 --- a/src/java/org/apache/fop/events/Event.java +++ b/src/java/org/apache/fop/events/Event.java @@ -32,11 +32,11 @@ import org.apache.fop.events.model.EventSeverity; public class Event extends EventObject { private static final long serialVersionUID = -1310594422868258083L; - + private String eventID; private EventSeverity severity; private Map params; - + /** * Creates a new Event. * @param source the object that creates the event @@ -50,7 +50,7 @@ public class Event extends EventObject { setSeverity(severity); this.params = params; } - + /** * Returns the event identifier. * @return the event identifier @@ -58,7 +58,7 @@ public class Event extends EventObject { public String getEventID() { return this.eventID; } - + /** * Returns the event group identifier. * @return the event group identifier (or null if there is no group identifier) @@ -71,7 +71,7 @@ public class Event extends EventObject { return null; } } - + /** * Returns the severity level. * @return the severity level @@ -79,7 +79,7 @@ public class Event extends EventObject { public EventSeverity getSeverity() { return this.severity; } - + /** * Sets the event's severity level. This method can be used to increase or decrease the * severity level in a listener. @@ -101,7 +101,7 @@ public class Event extends EventObject { return null; } } - + /** * Returns an unmodifiable {@link java.util.Map} with all event parameters. * @return the parameter map @@ -109,7 +109,7 @@ public class Event extends EventObject { public Map getParams() { return Collections.unmodifiableMap(this.params); } - + /** * Creates and returns a fluent builder object for building up the parameter map. * @return the parameter builder @@ -117,13 +117,13 @@ public class Event extends EventObject { public static ParamsBuilder paramsBuilder() { return new ParamsBuilder(); } - + /** * This class is a fluent builder class for building up the parameter map. */ public static class ParamsBuilder { private Map params; - + /** * Adds a new parameter (a name/value pair). * @param name the name of the parameter @@ -137,7 +137,7 @@ public class Event extends EventObject { this.params.put(name, value); return this; } - + /** * Returns the accumulated parameter map. * @return the accumulated parameter map @@ -146,5 +146,5 @@ public class Event extends EventObject { return this.params; } } - + } diff --git a/src/java/org/apache/fop/events/EventBroadcaster.java b/src/java/org/apache/fop/events/EventBroadcaster.java index 6c8df7375..bd522d329 100644 --- a/src/java/org/apache/fop/events/EventBroadcaster.java +++ b/src/java/org/apache/fop/events/EventBroadcaster.java @@ -31,31 +31,31 @@ public interface EventBroadcaster { * @param listener the listener to be added */ void addEventListener(EventListener listener); - + /** * Removes an event listener from the broadcaster. If the event listener is not registered, * nothing happens. * @param listener the listener to be removed */ void removeEventListener(EventListener listener); - + /** * Indicates whether any listeners have been registered with the broadcaster. * @return true if listeners are present, false otherwise */ boolean hasEventListeners(); - + /** * Broadcasts an event. This method is usually called from within the observed component. * @param event the event to be broadcast */ void broadcastEvent(Event event); - + /** * Returns an event producer instance for the given interface class. * @param clazz the Class object identifying an {@link EventProducer} interface * @return the event producer instance */ EventProducer getEventProducerFor(Class clazz); - + } diff --git a/src/java/org/apache/fop/events/EventExceptionManager.java b/src/java/org/apache/fop/events/EventExceptionManager.java index 44b1ef7b1..f6a115450 100644 --- a/src/java/org/apache/fop/events/EventExceptionManager.java +++ b/src/java/org/apache/fop/events/EventExceptionManager.java @@ -30,7 +30,7 @@ import org.apache.xmlgraphics.util.Service; public class EventExceptionManager { private static final Map EXCEPTION_FACTORIES = new java.util.HashMap(); - + static { Iterator iter; iter = Service.providers(ExceptionFactory.class, true); @@ -39,7 +39,7 @@ public class EventExceptionManager { EXCEPTION_FACTORIES.put(factory.getExceptionClass().getName(), factory); } } - + /** * Converts an event into an exception and throws that. If the exception class is null, * a {@link RuntimeException} will be thrown. @@ -61,20 +61,20 @@ public class EventExceptionManager { throw new RuntimeException(msg); } } - + /** * This interface is implementation by exception factories that can create exceptions from * events. */ public interface ExceptionFactory { - + /** * Creates an exception from an event. * @param event the event * @return the newly created exception */ Throwable createException(Event event); - + /** * Returns the {@link Exception} class created by this factory. * @return the exception class diff --git a/src/java/org/apache/fop/events/EventFormatter.java b/src/java/org/apache/fop/events/EventFormatter.java index 56964039b..fc779eb18 100644 --- a/src/java/org/apache/fop/events/EventFormatter.java +++ b/src/java/org/apache/fop/events/EventFormatter.java @@ -40,16 +40,16 @@ import org.apache.fop.util.text.AdvancedMessageFormat.PartFactory; public final class EventFormatter { private static final Pattern INCLUDES_PATTERN = Pattern.compile("\\{\\{.+\\}\\}"); - + private static ResourceBundle defaultBundle = XMLResourceBundle.getXMLBundle( EventFormatter.class.getName(), EventFormatter.class.getClassLoader()); - + private static Log log = LogFactory.getLog(EventFormatter.class); - + private EventFormatter() { //utility class } - + /** * Formats an event using the default locale. * @param event the event @@ -74,7 +74,7 @@ public final class EventFormatter { } return format(event, bundle); } - + /** * Formats an event using a given locale. * @param event the event @@ -150,11 +150,11 @@ public final class EventFormatter { params.put("severity", event.getSeverity()); return format.format(params); } - + private static class LookupFieldPart implements Part { - + private String fieldName; - + public LookupFieldPart(String fieldName) { this.fieldName = fieldName; } @@ -170,14 +170,14 @@ public final class EventFormatter { private String getKey(Map params) { return (String)params.get(fieldName); } - + /** {@inheritDoc} */ public String toString() { return "{" + this.fieldName + ", lookup}"; } - + } - + /** PartFactory for lookups. */ public static class LookupFieldPartFactory implements PartFactory { @@ -190,7 +190,7 @@ public final class EventFormatter { public String getFormat() { return "lookup"; } - + } } diff --git a/src/java/org/apache/fop/events/EventListener.java b/src/java/org/apache/fop/events/EventListener.java index cb2d8b965..4889d3299 100644 --- a/src/java/org/apache/fop/events/EventListener.java +++ b/src/java/org/apache/fop/events/EventListener.java @@ -33,5 +33,5 @@ public interface EventListener extends java.util.EventListener { * @param event the event */ void processEvent(Event event); - + } diff --git a/src/java/org/apache/fop/events/FOPEventListenerProxy.java b/src/java/org/apache/fop/events/FOPEventListenerProxy.java index d4c237844..d57ef1e15 100644 --- a/src/java/org/apache/fop/events/FOPEventListenerProxy.java +++ b/src/java/org/apache/fop/events/FOPEventListenerProxy.java @@ -29,29 +29,29 @@ import org.apache.fop.layoutmgr.BlockLevelEventProducer; * For validation events, it reacts on each event based on the strict validation setting in * the user agent. * For layout events, it reduces the default severity level if FOP signals that it can recover - * from the event. + * from the event. */ public class FOPEventListenerProxy implements EventListener { private static final String FOVALIDATION_EVENT_ID_PREFIX = FOValidationEventProducer.class.getName(); - + private static final String BLOCK_LEVEL_EVENT_ID_PREFIX = BlockLevelEventProducer.class.getName(); private EventListener delegate; private FOUserAgent userAgent; - + /** * Main constructor. - * @param delegate the event listener to delegate events to + * @param delegate the event listener to delegate events to * @param userAgent the FO user agent */ public FOPEventListenerProxy(EventListener delegate, FOUserAgent userAgent) { this.delegate = delegate; this.userAgent = userAgent; } - + /** {@inheritDoc} */ public synchronized void processEvent(Event event) { if (event.getEventID().startsWith(FOVALIDATION_EVENT_ID_PREFIX)) { diff --git a/src/java/org/apache/fop/events/LoggingEventListener.java b/src/java/org/apache/fop/events/LoggingEventListener.java index 9ba8ed2df..03467303e 100644 --- a/src/java/org/apache/fop/events/LoggingEventListener.java +++ b/src/java/org/apache/fop/events/LoggingEventListener.java @@ -32,17 +32,17 @@ public class LoggingEventListener implements EventListener { /** Default logger instance */ private static Log defaultLog = LogFactory.getLog(LoggingEventListener.class); - + private Log log; private boolean skipFatal; - + /** * Creates an instance logging to the default log category of this class. */ public LoggingEventListener() { this(defaultLog); } - + /** * Creates an instance logging to a given logger. Events with fatal severity level will be * skipped. @@ -51,7 +51,7 @@ public class LoggingEventListener implements EventListener { public LoggingEventListener(Log log) { this(log, true); } - + /** * Creates an instance logging to a given logger. * @param log the target logger @@ -61,7 +61,7 @@ public class LoggingEventListener implements EventListener { this.log = log; this.skipFatal = skipFatal; } - + /** * Returns the target logger for this instance. * @return the target logger @@ -69,7 +69,7 @@ public class LoggingEventListener implements EventListener { public Log getLog() { return this.log; } - + /** {@inheritDoc} */ public void processEvent(Event event) { String msg = EventFormatter.format(event); diff --git a/src/java/org/apache/fop/events/PropertyExceptionFactory.java b/src/java/org/apache/fop/events/PropertyExceptionFactory.java index 667c4a16e..753019b31 100644 --- a/src/java/org/apache/fop/events/PropertyExceptionFactory.java +++ b/src/java/org/apache/fop/events/PropertyExceptionFactory.java @@ -38,10 +38,10 @@ public class PropertyExceptionFactory implements ExceptionFactory { } return ex; } - + /** {@inheritDoc} */ public Class getExceptionClass() { return PropertyException.class; } - + }
\ No newline at end of file diff --git a/src/java/org/apache/fop/events/ResourceEventProducer.java b/src/java/org/apache/fop/events/ResourceEventProducer.java index 21da4f1d7..607d2fab1 100644 --- a/src/java/org/apache/fop/events/ResourceEventProducer.java +++ b/src/java/org/apache/fop/events/ResourceEventProducer.java @@ -38,7 +38,7 @@ public interface ResourceEventProducer extends EventProducer { * Provider class for the event producer. */ class Provider { - + /** * Returns an event producer. * @param broadcaster the event broadcaster to use @@ -59,7 +59,7 @@ public interface ResourceEventProducer extends EventProducer { * @event.severity ERROR */ void imageNotFound(Object source, String uri, FileNotFoundException fnfe, Locator loc); - + /** * Error while processing image. * @param source the event source @@ -69,7 +69,7 @@ public interface ResourceEventProducer extends EventProducer { * @event.severity ERROR */ void imageError(Object source, String uri, ImageException e, Locator loc); - + /** * I/O error while loading an image. * @param source the event source @@ -105,7 +105,7 @@ public interface ResourceEventProducer extends EventProducer { * @event.severity ERROR */ void ifoNoIntrinsicSize(Object source, Locator loc); - + /** * Error processing foreign XML content. * @param source the event source @@ -124,7 +124,7 @@ public interface ResourceEventProducer extends EventProducer { * @event.severity ERROR */ void foreignXMLNoHandler(Object source, Document doc, String namespaceURI); - + /** * Cannot delete a temporary file. * @param source the event source @@ -132,5 +132,5 @@ public interface ResourceEventProducer extends EventProducer { * @event.severity ERROR */ void cannotDeleteTempFile(Object source, File tempFile); - + } diff --git a/src/java/org/apache/fop/events/UnsupportedOperationExceptionFactory.java b/src/java/org/apache/fop/events/UnsupportedOperationExceptionFactory.java index 06ce8dd25..7ec9d19b2 100644 --- a/src/java/org/apache/fop/events/UnsupportedOperationExceptionFactory.java +++ b/src/java/org/apache/fop/events/UnsupportedOperationExceptionFactory.java @@ -34,10 +34,10 @@ public class UnsupportedOperationExceptionFactory implements ExceptionFactory { UnsupportedOperationException ex = new UnsupportedOperationException(msg); return ex; } - + /** {@inheritDoc} */ public Class getExceptionClass() { return UnsupportedOperationException.class; } - + }
\ No newline at end of file diff --git a/src/java/org/apache/fop/events/ValidationExceptionFactory.java b/src/java/org/apache/fop/events/ValidationExceptionFactory.java index 9dba84007..760c4ec58 100644 --- a/src/java/org/apache/fop/events/ValidationExceptionFactory.java +++ b/src/java/org/apache/fop/events/ValidationExceptionFactory.java @@ -41,11 +41,11 @@ public class ValidationExceptionFactory implements ExceptionFactory { } return ex; } - + /** {@inheritDoc} */ public Class getExceptionClass() { return ValidationException.class; } - - + + }
\ No newline at end of file diff --git a/src/java/org/apache/fop/events/model/AbstractEventModelFactory.java b/src/java/org/apache/fop/events/model/AbstractEventModelFactory.java index ee980f34e..fbb8b1550 100644 --- a/src/java/org/apache/fop/events/model/AbstractEventModelFactory.java +++ b/src/java/org/apache/fop/events/model/AbstractEventModelFactory.java @@ -45,17 +45,17 @@ public abstract class AbstractEventModelFactory implements EventModelFactory { if (in == null) { throw new MissingResourceException( "File " + resourceName + " not found", - DefaultEventBroadcaster.class.getName(), ""); + DefaultEventBroadcaster.class.getName(), ""); } try { return EventModelParser.parse(new StreamSource(in)); } catch (TransformerException e) { throw new MissingResourceException( "Error reading " + resourceName + ": " + e.getMessage(), - DefaultEventBroadcaster.class.getName(), ""); + DefaultEventBroadcaster.class.getName(), ""); } finally { IOUtils.closeQuietly(in); } } - + } diff --git a/src/java/org/apache/fop/events/model/EventModelFactory.java b/src/java/org/apache/fop/events/model/EventModelFactory.java index cd760501c..ea5b2cdbb 100644 --- a/src/java/org/apache/fop/events/model/EventModelFactory.java +++ b/src/java/org/apache/fop/events/model/EventModelFactory.java @@ -29,5 +29,5 @@ public interface EventModelFactory { * @return the new EventModel instance */ EventModel createEventModel(); - + } diff --git a/src/java/org/apache/fop/events/model/EventModelParser.java b/src/java/org/apache/fop/events/model/EventModelParser.java index 600e495c5..ddb1bf663 100644 --- a/src/java/org/apache/fop/events/model/EventModelParser.java +++ b/src/java/org/apache/fop/events/model/EventModelParser.java @@ -45,7 +45,7 @@ public class EventModelParser { /** Logger instance */ protected static Log log = LogFactory.getLog(EventModelParser.class); - private static SAXTransformerFactory tFactory + private static SAXTransformerFactory tFactory = (SAXTransformerFactory)SAXTransformerFactory.newInstance(); /** @@ -54,11 +54,11 @@ public class EventModelParser { * @return the created event model structure * @throws TransformerException if an error occurs while parsing the XML file */ - public static EventModel parse(Source src) + public static EventModel parse(Source src) throws TransformerException { Transformer transformer = tFactory.newTransformer(); transformer.setErrorListener(new DefaultErrorListener(log)); - + EventModel model = new EventModel(); SAXResult res = new SAXResult(getContentHandler(model)); diff --git a/src/java/org/apache/fop/events/model/EventSeverity.java b/src/java/org/apache/fop/events/model/EventSeverity.java index d37c53c1e..c0d886154 100644 --- a/src/java/org/apache/fop/events/model/EventSeverity.java +++ b/src/java/org/apache/fop/events/model/EventSeverity.java @@ -26,7 +26,7 @@ import java.io.Serializable; public final class EventSeverity implements Serializable { private static final long serialVersionUID = 4108175215810759243L; - + /** info level */ public static final EventSeverity INFO = new EventSeverity("INFO"); /** warning level */ @@ -35,7 +35,7 @@ public final class EventSeverity implements Serializable { public static final EventSeverity ERROR = new EventSeverity("ERROR"); /** fatal error */ public static final EventSeverity FATAL = new EventSeverity("FATAL"); - + private String name; /** @@ -50,7 +50,7 @@ public final class EventSeverity implements Serializable { public String getName() { return this.name; } - + /** * Returns the enumeration/singleton object based on its name. * @param name the name of the enumeration value @@ -69,14 +69,14 @@ public final class EventSeverity implements Serializable { throw new IllegalArgumentException("Illegal value for enumeration: " + name); } } - + private Object readResolve() throws ObjectStreamException { return valueOf(getName()); } - + /** {@inheritDoc} */ public String toString() { return "EventSeverity:" + name; } - + } |