You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2005/09/20 17:25:03 UTC

svn commit: r290470 - /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java

Author: jukka
Date: Tue Sep 20 08:24:58 2005
New Revision: 290470

URL: http://svn.apache.org/viewcvs?rev=290470&view=rev
Log:
JCR-142: Allow subclassing of NodeTypeReader as suggested by Brian Moseley.

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java?rev=290470&r1=290469&r2=290470&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java Tue Sep 20 08:24:58 2005
@@ -36,13 +36,14 @@
 import javax.jcr.version.OnParentVersionAction;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.Properties;
 import java.util.Vector;
 
 /**
  * Node type definition reader. This class is used to read the
  * persistent node type definition files used by Jackrabbit.
  */
-public final class NodeTypeReader {
+public class NodeTypeReader {
 
     /**
      * Reads a node type definition file. The file contents are read from
@@ -73,6 +74,9 @@
     /** The node type document walker. */
     private final DOMWalker walker;
 
+    /** The namespaces associated with the node type XML document. */
+    private final Properties namespaces;
+
     /** The namespace resolver. */
     private final NamespaceResolver resolver;
 
@@ -82,9 +86,18 @@
      * @param xml node type definition file
      * @throws IOException if the node type definition file cannot be read
      */
-    private NodeTypeReader(InputStream xml) throws IOException {
+    public NodeTypeReader(InputStream xml) throws IOException {
         walker = new DOMWalker(xml);
-        resolver = new AdditionalNamespaceResolver(walker.getNamespaces());
+        namespaces = walker.getNamespaces();
+        resolver = new AdditionalNamespaceResolver(namespaces);
+    }
+
+    /**
+     * Returns the namespaces declared in the node type definition
+     * file.
+     */
+    public Properties getNamespaces() {
+        return namespaces;
     }
 
     /**
@@ -98,7 +111,7 @@
      * @throws UnknownPrefixException      if a definition contains an
      *                                     unknown namespace prefix
      */
-    private NodeTypeDef[] getNodeTypeDefs()
+    public NodeTypeDef[] getNodeTypeDefs()
             throws InvalidNodeTypeDefException, IllegalNameException,
             UnknownPrefixException {
         Vector defs = new Vector();