You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2008/04/02 12:00:37 UTC
svn commit: r643824 - in
/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events:
LoggingEventListener.java model/EventMethodModel.java model/EventModel.java
model/EventProducerModel.java
Author: jeremias
Date: Wed Apr 2 03:00:30 2008
New Revision: 643824
URL: http://svn.apache.org/viewvc?rev=643824&view=rev
Log:
Javadocs.
Modified:
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/LoggingEventListener.java
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/EventModel.java
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/model/EventProducerModel.java
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/LoggingEventListener.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/LoggingEventListener.java?rev=643824&r1=643823&r2=643824&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/LoggingEventListener.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/LoggingEventListener.java Wed Apr 2 03:00:30 2008
@@ -36,19 +36,36 @@
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.
+ * @param log the target logger
+ */
public LoggingEventListener(Log log) {
this(log, true);
}
+ /**
+ * Creates an instance logging to a given logger.
+ * @param log the target logger
+ * @param skipFatal true if events with fatal severity level should be skipped (i.e. not logged)
+ */
public LoggingEventListener(Log log, boolean skipFatal) {
this.log = log;
this.skipFatal = skipFatal;
}
+ /**
+ * Returns the target logger for this instance.
+ * @return the target logger
+ */
public Log getLog() {
return this.log;
}
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=643824&r1=643823&r2=643824&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 Wed Apr 2 03:00:30 2008
@@ -30,52 +30,103 @@
import org.apache.xmlgraphics.util.XMLizable;
+/**
+ * Represents an event method. Each method in an event producer interface will result in one
+ * instance of <code>EventMethodModel</code>.
+ */
public class EventMethodModel implements Serializable, XMLizable {
+ private static final long serialVersionUID = -7548882973341444354L;
+
private String methodName;
private EventSeverity severity;
private List params = new java.util.ArrayList();
private String exceptionClass;
+ /**
+ * Creates an new instance.
+ * @param methodName the event method's name
+ * @param severity the event severity
+ */
public EventMethodModel(String methodName, EventSeverity severity) {
this.methodName = methodName;
this.severity = severity;
}
+ /**
+ * Adds a method parameter.
+ * @param param the method parameter
+ */
public void addParameter(Parameter param) {
this.params.add(param);
}
+ /**
+ * Adds a method parameter.
+ * @param type the type of the parameter
+ * @param name the name of the parameter
+ * @return the resulting Parameter instance
+ */
public Parameter addParameter(Class type, String name) {
Parameter param = new Parameter(type, name);
- this.params.add(param);
+ addParameter(param);
return param;
}
+ /**
+ * Sets the event method name.
+ * @param name the event name
+ */
public void setMethodName(String name) {
this.methodName = name;
}
+ /**
+ * Returns the event method name
+ * @return the event name
+ */
public String getMethodName() {
return this.methodName;
}
+ /**
+ * Sets the event's severity level.
+ * @param severity the severity
+ */
public void setSeverity(EventSeverity severity) {
this.severity = severity;
}
+ /**
+ * Returns the event's severity level.
+ * @return the severity
+ */
public EventSeverity getSeverity() {
return this.severity;
}
+ /**
+ * Returns an unmodifiable list of parameters for this event method.
+ * @return the list of parameters
+ */
public List getParameters() {
return Collections.unmodifiableList(this.params);
}
+ /**
+ * Sets the primary exception class for this event method. Note: Not all event methods throw
+ * exceptions!
+ * @param exceptionClass the exception class
+ */
public void setExceptionClass(String exceptionClass) {
this.exceptionClass = exceptionClass;
}
+ /**
+ * Returns the primary exception class for this event method. This method returns null if
+ * the event is only informational or just a warning.
+ * @return the primary exception class or null
+ */
public String getExceptionClass() {
return this.exceptionClass;
}
@@ -97,20 +148,38 @@
handler.endElement(null, elName, elName);
}
+ /**
+ * Represents an event parameter.
+ */
public static class Parameter implements Serializable, XMLizable {
+ private static final long serialVersionUID = 6062500277953887099L;
+
private Class type;
private String name;
+ /**
+ * Creates a new event parameter.
+ * @param type the parameter type
+ * @param name the parameter name
+ */
public Parameter(Class type, String name) {
this.type = type;
this.name = name;
}
+ /**
+ * Returns the parameter type.
+ * @return the parameter type
+ */
public Class getType() {
return this.type;
}
+ /**
+ * Returns the parameter name.
+ * @return the parameter name
+ */
public String getName() {
return this.name;
}
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/model/EventModel.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/model/EventModel.java?rev=643824&r1=643823&r2=643824&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/model/EventModel.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/model/EventModel.java Wed Apr 2 03:00:30 2008
@@ -40,25 +40,51 @@
import org.apache.xmlgraphics.util.XMLizable;
+/**
+ * Represents a whole event model that supports multiple event producers.
+ */
public class EventModel implements Serializable, XMLizable {
+ private static final long serialVersionUID = 7468592614934605082L;
+
private Map producers = new java.util.LinkedHashMap();
+ /**
+ * Creates a new, empty event model
+ */
public EventModel() {
}
+ /**
+ * Adds the model of an event producer to the event model.
+ * @param producer the event producer model
+ */
public void addProducer(EventProducerModel producer) {
this.producers.put(producer.getInterfaceName(), producer);
}
+ /**
+ * Returns an iterator over the contained event producer models.
+ * @return an iterator (Iterator<EventProducerModel>)
+ */
public Iterator getProducers() {
return this.producers.values().iterator();
}
+ /**
+ * Returns the model of an event producer with the given interface name.
+ * @param interfaceName the fully qualified name of the event producer
+ * @return the model instance for the event producer (or null if it wasn't found)
+ */
public EventProducerModel getProducer(String interfaceName) {
return (EventProducerModel)this.producers.get(interfaceName);
}
+ /**
+ * Returns the model of an event producer with the given interface.
+ * @param clazz the interface of the event producer
+ * @return the model instance for the event producer (or null if it wasn't found)
+ */
public EventProducerModel getProducer(Class clazz) {
return getProducer(clazz.getName());
}
@@ -97,6 +123,11 @@
}
}
+ /**
+ * Saves this event model to an XML file.
+ * @param modelFile the target file
+ * @throws IOException if an I/O error occurs
+ */
public void saveToXML(File modelFile) throws IOException {
writeXMLizable(this, modelFile);
}
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/model/EventProducerModel.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/model/EventProducerModel.java?rev=643824&r1=643823&r2=643824&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/model/EventProducerModel.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/model/EventProducerModel.java Wed Apr 2 03:00:30 2008
@@ -29,31 +29,61 @@
import org.apache.xmlgraphics.util.XMLizable;
+/**
+ * Represents the model of an event producer with multiple event methods.
+ */
public class EventProducerModel implements Serializable, XMLizable {
+ private static final long serialVersionUID = 122267104123721902L;
+
private String interfaceName;
private Map methods = new java.util.LinkedHashMap();
+ /**
+ * Creates a new instance.
+ * @param interfaceName the fully qualified interface name of the event producer
+ */
public EventProducerModel(String interfaceName) {
this.interfaceName = interfaceName;
}
+ /**
+ * Returns the fully qualified interface name of the event producer.
+ * @return the fully qualified interface name
+ */
public String getInterfaceName() {
return this.interfaceName;
}
+ /**
+ * Sets the fully qualified interface name of the event producer.
+ * @param name the fully qualified interface name
+ */
public void setInterfaceName(String name) {
this.interfaceName = name;
}
+ /**
+ * Adds a model instance of an event method.
+ * @param method the event method model
+ */
public void addMethod(EventMethodModel method) {
this.methods.put(method.getMethodName(), method);
}
+ /**
+ * Returns the model instance of an event method for the given method name.
+ * @param methodName the method name
+ * @return the model instance (or null if no method with the given name exists)
+ */
public EventMethodModel getMethod(String methodName) {
return (EventMethodModel)this.methods.get(methodName);
}
+ /**
+ * Returns an iterator over the contained event producer methods.
+ * @return an iterator (Iterator<EventMethodModel>)
+ */
public Iterator getMethods() {
return this.methods.values().iterator();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org