jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r384565 - in /incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml: DocViewImportHandler.java SysViewImportHandler.java TargetImportHandler.java
Date Thu, 09 Mar 2006 17:38:06 GMT
Author: jukka
Date: Thu Mar  9 09:38:04 2006
New Revision: 384565

URL: http://svn.apache.org/viewcvs?rev=384565&view=rev
Log:
Removed duplicate code by moving the identical startDocument() and endDocument() methods from
the DocView- and SysViewImportHandler classes to the common TargetImportHandler base class.

Modified:
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/TargetImportHandler.java

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java?rev=384565&r1=384564&r2=384565&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java
(original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java
Thu Mar  9 09:38:04 2006
@@ -150,16 +150,6 @@
     }
 
     //-------------------------------------------------------< ContentHandler >
-    /**
-     * {@inheritDoc}
-     */
-    public void startDocument() throws SAXException {
-        try {
-            importer.start();
-        } catch (RepositoryException re) {
-            throw new SAXException(re);
-        }
-    }
 
     /**
      * {@inheritDoc}
@@ -300,16 +290,5 @@
         }
         // we're done with this node, pop it from stack
         stack.pop();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void endDocument() throws SAXException {
-        try {
-            importer.end();
-        } catch (RepositoryException re) {
-            throw new SAXException(re);
-        }
     }
 }

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java?rev=384565&r1=384564&r2=384565&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java
(original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java
Thu Mar  9 09:38:04 2006
@@ -99,16 +99,6 @@
     }
 
     //-------------------------------------------------------< ContentHandler >
-    /**
-     * {@inheritDoc}
-     */
-    public void startDocument() throws SAXException {
-        try {
-            importer.start();
-        } catch (RepositoryException re) {
-            throw new SAXException(re);
-        }
-    }
 
     /**
      * {@inheritDoc}
@@ -305,17 +295,6 @@
             currentPropValue = null;
         } else {
             throw new SAXException(new InvalidSerializedDataException("invalid element in
system view xml document: " + localName));
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void endDocument() throws SAXException {
-        try {
-            importer.end();
-        } catch (RepositoryException re) {
-            throw new SAXException(re);
         }
     }
 

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/TargetImportHandler.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/TargetImportHandler.java?rev=384565&r1=384564&r2=384565&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/TargetImportHandler.java
(original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/TargetImportHandler.java
Thu Mar  9 09:38:04 2006
@@ -19,6 +19,7 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.util.TransientFileFactory;
 import org.apache.log4j.Logger;
+import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
 
 import java.io.File;
@@ -30,6 +31,8 @@
 import java.io.FileOutputStream;
 import java.io.OutputStreamWriter;
 
+import javax.jcr.RepositoryException;
+
 /**
  * <code>TargetImportHandler</code> serves as the base class for the concrete
  * classes <code>{@link DocViewImportHandler}</code> and
@@ -65,6 +68,38 @@
                     // fall through...
                 }
             }
+        }
+    }
+
+    //-------------------------------------------------------< ContentHandler >
+
+    /**
+     * Initializes the underlying {@link Importer} instance. This method
+     * is called by the XML parser when the XML document starts.
+     *
+     * @throws SAXException if the importer can not be initialized
+     * @see DefaultHandler#startDocument()
+     */
+    public void startDocument() throws SAXException {
+        try {
+            importer.start();
+        } catch (RepositoryException re) {
+            throw new SAXException(re);
+        }
+    }
+
+    /**
+     * Closes the underlying {@link Importer} instance. This method
+     * is called by the XML parser when the XML document ends.
+     *
+     * @throws SAXException if the importer can not be closed
+     * @see DefaultHandler#endDocument()
+     */
+    public void endDocument() throws SAXException {
+        try {
+            importer.end();
+        } catch (RepositoryException re) {
+            throw new SAXException(re);
         }
     }
 



Mime
View raw message