jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r763248 - in /jackrabbit/trunk/jackrabbit-core/src/main: java/org/apache/jackrabbit/core/nodetype/ resources/org/apache/jackrabbit/core/nodetype/
Date Wed, 08 Apr 2009 13:58:38 GMT
Author: tripod
Date: Wed Apr  8 13:58:37 2009
New Revision: 763248

URL: http://svn.apache.org/viewvc?rev=763248&view=rev
Log:
JCR-2065 use the internal CND file for builtin nodetypes

Removed:
    jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml
Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
    jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java?rev=763248&r1=763247&r2=763248&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java
Wed Apr  8 13:58:37 2009
@@ -18,16 +18,21 @@
 
 import org.apache.jackrabbit.core.nodetype.xml.NodeTypeReader;
 import org.apache.jackrabbit.core.nodetype.xml.NodeTypeWriter;
+import org.apache.jackrabbit.core.nodetype.compact.CompactNodeTypeDefReader;
+import org.apache.jackrabbit.core.nodetype.compact.ParseException;
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.commons.name.NameConstants;
 
 import javax.jcr.NamespaceRegistry;
 import javax.jcr.RepositoryException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.Reader;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.Iterator;
 
 /**
  * <code>NodeTypeDefStore</code> ...
@@ -59,6 +64,28 @@
     }
 
     /**
+     * Loads node types from a CND stream.
+     * 
+     * @param in reader containing the nodetype definitions
+     * @param systemId optional name of the stream
+     *
+     * @throws IOException if an I/O error during reading occurrs
+     * @throws InvalidNodeTypeDefException if the CND cannot be parsed
+     */
+    public void loadCND(Reader in, String systemId)
+            throws IOException, InvalidNodeTypeDefException {
+        try {
+            CompactNodeTypeDefReader r = new CompactNodeTypeDefReader(in, systemId);
+            Iterator iter = r.getNodeTypeDefs().iterator();
+            while (iter.hasNext()) {
+                add((NodeTypeDef) iter.next());
+            }
+        } catch (ParseException e) {
+            throw new InvalidNodeTypeDefException("Unable to parse CND stream.", e);
+        }
+    }
+
+    /**
      * @param out
      * @param registry
      * @throws IOException

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java?rev=763248&r1=763247&r2=763248&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
Wed Apr  8 13:58:37 2009
@@ -35,6 +35,8 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PrintStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -59,7 +61,7 @@
     private static Logger log = LoggerFactory.getLogger(NodeTypeRegistry.class);
 
     private static final String BUILTIN_NODETYPES_RESOURCE_PATH =
-            "org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml";
+            "org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd";
     private static final String CUSTOM_NODETYPES_RESOURCE_NAME =
             "custom_nodetypes.xml";
 
@@ -798,7 +800,10 @@
         InputStream in = null;
         try {
             in = getClass().getClassLoader().getResourceAsStream(BUILTIN_NODETYPES_RESOURCE_PATH);
-            store.load(in);
+            if (in != null) {
+                Reader r = new InputStreamReader(in, "utf-8");
+                store.loadCND(r, BUILTIN_NODETYPES_RESOURCE_PATH);
+            }
         } catch (IOException ioe) {
             String error =
                     "internal error: failed to read built-in node type definitions stored
in "

Modified: jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd?rev=763248&r1=763247&r2=763248&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
Wed Apr  8 13:58:37 2009
@@ -43,6 +43,12 @@
   - jcr:lockOwner (string) protected ignore
   - jcr:lockIsDeep (boolean) protected ignore
 
+/**
+ * @since 2.0
+ */
+[mix:shareable] > mix:referenceable
+  mixin
+
 //------------------------------------------------------------------------------
 // V E R S I O N I N G
 //------------------------------------------------------------------------------
@@ -58,7 +64,7 @@
     < 'nt:version'
   - jcr:mergeFailed (reference) protected multiple abort
 
-[nt:versionHistory] > mix:referenceable
+[nt:versionHistory] > nt:base, mix:referenceable
   - jcr:versionableUuid (string) mandatory autocreated protected abort
   + jcr:rootVersion (nt:version) = nt:version mandatory autocreated protected abort
   + jcr:versionLabels (nt:versionLabels) = nt:versionLabels mandatory autocreated protected
abort
@@ -68,7 +74,7 @@
   - * (reference) protected abort
     < 'nt:version'
 
-[nt:version] > mix:referenceable
+[nt:version] > nt:base, mix:referenceable
   - jcr:created (date) mandatory autocreated protected abort
   - jcr:predecessors (reference) protected multiple abort
     < 'nt:version'
@@ -76,7 +82,7 @@
     < 'nt:version'
   + jcr:frozenNode (nt:frozenNode) protected abort
 
-[nt:frozenNode] > mix:referenceable
+[nt:frozenNode] > nt:base, mix:referenceable
   orderable
   - jcr:frozenPrimaryType (name) mandatory autocreated protected abort
   - jcr:frozenMixinTypes (name) protected multiple abort
@@ -142,7 +148,7 @@
 [nt:linkedFile] > nt:hierarchyNode
   - jcr:content (reference) primary mandatory
 
-[nt:resource] > mix:referenceable
+[nt:resource] > nt:base, mix:referenceable
   - jcr:encoding (string)
   - jcr:mimeType (string) mandatory
   - jcr:data (binary) primary mandatory
@@ -201,7 +207,7 @@
 // Principal based AC
 // -----------------------------------------------------------------------------
 
-[rep:AccessControl] > nt:base
+[rep:AccessControl]
   + * (rep:AccessControl) protected ignore
   + * (rep:PrincipalAccessControl) protected ignore
 



Mime
View raw message