commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r743411 - in /commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml: DefaultContentHandler.java ProxyContentHandler.java SerializingContentHandler.java
Date Wed, 11 Feb 2009 17:23:13 GMT
Author: jukka
Date: Wed Feb 11 17:23:13 2009
New Revision: 743411

URL: http://svn.apache.org/viewvc?rev=743411&view=rev
Log:
xml: Rename and adapt DefaultContentHandler to ProxyContentHandler for consistency with concepts
in Commons IO.

Added:
    commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/ProxyContentHandler.java
  (contents, props changed)
      - copied, changed from r742536, commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/DefaultContentHandler.java
Removed:
    commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/DefaultContentHandler.java
Modified:
    commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/SerializingContentHandler.java

Copied: commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/ProxyContentHandler.java
(from r742536, commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/DefaultContentHandler.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/ProxyContentHandler.java?p2=commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/ProxyContentHandler.java&p1=commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/DefaultContentHandler.java&r1=742536&r2=743411&rev=743411&view=diff
==============================================================================
--- commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/DefaultContentHandler.java
(original)
+++ commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/ProxyContentHandler.java
Wed Feb 11 17:23:13 2009
@@ -23,23 +23,30 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /**
- * Adapter that makes a {@link ContentHandler} instance look like a
- * {@link DefaultHandler}.
+ * A proxy content handler that passes all SAX events as-is to the
+ * proxied handler.
+ * <p>
+ * As a convenience this class inherits the {@link DefaultHandler} class
+ * instead of just the {@link ContentHandler} interface. This makes it
+ * possible to use this class as an adapter when using methods like
+ * {@link javax.xml.parsers.SAXParser#parse(String, DefaultHandler)} that
+ * expect a DefaultHandler instance instead of a ContentHandler.
  */
-public class DefaultContentHandler extends DefaultHandler {
+public class ProxyContentHandler extends DefaultHandler {
 
     /**
-     * The adapted content handler instance.
+     * The proxied content handler. This is a protected, non-final field
+     * so that subclasses can access the proxied handler or even replace
+     * it they want.
      */
-    private final ContentHandler handler;
+    protected ContentHandler handler;
 
     /**
-     * Creates a {@link DefaultHandler} adapter for the given content
-     * handler.
+     * Creates a proxy for the given content handler.
      *
-     * @param handler content handler
+     * @param handler content handler to be proxied
      */
-    public DefaultContentHandler(ContentHandler handler) {
+    public ProxyContentHandler(ContentHandler handler) {
         this.handler = handler;
     }
 

Propchange: commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/ProxyContentHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/ProxyContentHandler.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Modified: commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/SerializingContentHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/SerializingContentHandler.java?rev=743411&r1=743410&r2=743411&view=diff
==============================================================================
--- commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/SerializingContentHandler.java
(original)
+++ commons/sandbox/xml/trunk/src/main/java/org/apache/commons/xml/SerializingContentHandler.java
Wed Feb 11 17:23:13 2009
@@ -57,7 +57,7 @@
  * org.apache.jackrabbit.commons.xml.SerializingContentHandler class in
  * the jackrabbit-jcr-commons component for the Jackrabbit version.
  */
-public class SerializingContentHandler extends DefaultContentHandler {
+public class SerializingContentHandler extends ProxyContentHandler {
 
     /**
      * The character encoding used for serialization (UTF-8).
@@ -163,7 +163,7 @@
                 // so we need to do it explicitly with this wrapper
                 return new SerializingContentHandler(handler);
             } else {
-                return new DefaultContentHandler(handler);
+                return new ProxyContentHandler(handler);
             }
         } catch (TransformerConfigurationException e) {
             throw new SAXException("Failed to initialize XML serializer", e);



Mime
View raw message