jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r814651 - in /jackrabbit/sandbox/JCR-2170: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/node...
Date Mon, 14 Sep 2009 14:15:35 GMT
Author: mreutegg
Date: Mon Sep 14 14:15:34 2009
New Revision: 814651

URL: http://svn.apache.org/viewvc?rev=814651&view=rev
Log:
JCR-2170: Remove PropDefId and NodeDefId
- merge with recent changes from trunk

Added:
    jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/
      - copied from r814628, jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/
    jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/AbstractItemTypeDefinitionsBuilder.java
      - copied unchanged from r814628, jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/AbstractItemTypeDefinitionsBuilder.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CndImporter.java
      - copied unchanged from r814628, jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CndImporter.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CompactNodeTypeDefReader.java
      - copied unchanged from r814628, jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CompactNodeTypeDefReader.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/ItemTemplatesBuilder.java
      - copied unchanged from r814628, jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/ItemTemplatesBuilder.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/Lexer.java
      - copied unchanged from r814628, jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/Lexer.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/ParseException.java
      - copied unchanged from r814628, jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/ParseException.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/QItemDefinitionsBuilder.java
      - copied unchanged from r814628, jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/QItemDefinitionsBuilder.java
Removed:
    jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/CompactNodeTypeDefReader.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/Lexer.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/ParseException.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/QNodeTypeDefinitionsBuilder.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/QNodeTypeDefinitionsBuilderImpl.java
Modified:
    jackrabbit/sandbox/JCR-2170/   (props changed)
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractRecord.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateProvider.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/Serializer.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/NodeTypeTest.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/TestAll.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/MixinTest.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/DocumentViewTest.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/AbstractJCR2SPITest.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractRepositoryService.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/CompactNodeTypeDefWriter.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/nodetype/compact/CompactNodeTypeDefTest.java

Propchange: jackrabbit/sandbox/JCR-2170/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 14 14:15:34 2009
@@ -1,3 +1,3 @@
 /jackrabbit/branches/1.5:794012,794100,794102
 /jackrabbit/sandbox/tripod-JCR-2209:795441-795863
-/jackrabbit/trunk:812417-813816
+/jackrabbit/trunk:812417-814628

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractRecord.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractRecord.java?rev=814651&r1=814650&r2=814651&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractRecord.java
(original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractRecord.java
Mon Sep 14 14:15:34 2009
@@ -25,6 +25,8 @@
 
 import org.apache.commons.collections.BidiMap;
 import org.apache.commons.collections.bidimap.DualHashBidiMap;
+import org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader;
+import org.apache.jackrabbit.commons.cnd.ParseException;
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.nodetype.NodeTypeDef;
@@ -37,9 +39,8 @@
 import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceMapping;
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
-import org.apache.jackrabbit.spi.commons.nodetype.compact.CompactNodeTypeDefReader;
+import org.apache.jackrabbit.spi.commons.nodetype.QItemDefinitionsBuilder;
 import org.apache.jackrabbit.spi.commons.nodetype.compact.CompactNodeTypeDefWriter;
-import org.apache.jackrabbit.spi.commons.nodetype.compact.ParseException;
 
 /**
  * Base implementation for a record.
@@ -248,8 +249,12 @@
     public NodeTypeDef readNodeTypeDef() throws JournalException {
         try {
             StringReader sr = new StringReader(readString());
-            CompactNodeTypeDefReader reader = new CompactNodeTypeDefReader(
-                    sr, "(internal)", new NamespaceMapping(nsResolver));
+
+            CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping> reader
=
+                new CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping>(
+                    sr, "(internal)", new NamespaceMapping(nsResolver),
+                    new QItemDefinitionsBuilder());
+
             Collection<QNodeTypeDefinition> ntds = reader.getNodeTypeDefinitions();
             if (ntds.size() != 1) {
                 throw new JournalException("Expected one node type definition: got " + ntds.size());

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java?rev=814651&r1=814650&r2=814651&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java
(original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefStore.java
Mon Sep 14 14:15:34 2009
@@ -28,12 +28,14 @@
 import javax.jcr.NamespaceRegistry;
 import javax.jcr.RepositoryException;
 
+import org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader;
+import org.apache.jackrabbit.commons.cnd.ParseException;
 import org.apache.jackrabbit.core.nodetype.xml.NodeTypeReader;
 import org.apache.jackrabbit.core.nodetype.xml.NodeTypeWriter;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.QNodeTypeDefinition;
-import org.apache.jackrabbit.spi.commons.nodetype.compact.CompactNodeTypeDefReader;
-import org.apache.jackrabbit.spi.commons.nodetype.compact.ParseException;
+import org.apache.jackrabbit.spi.commons.namespace.NamespaceMapping;
+import org.apache.jackrabbit.spi.commons.nodetype.QItemDefinitionsBuilder;
 
 /**
  * <code>NodeTypeDefStore</code> ...
@@ -66,7 +68,7 @@
 
     /**
      * Loads node types from a CND stream.
-     * 
+     *
      * @param in reader containing the nodetype definitions
      * @param systemId optional name of the stream
      *
@@ -76,7 +78,10 @@
     public void loadCND(Reader in, String systemId)
             throws IOException, InvalidNodeTypeDefException {
         try {
-            CompactNodeTypeDefReader r = new CompactNodeTypeDefReader(in, systemId);
+            CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping> r =
+                new CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping>(
+                    in, systemId, new QItemDefinitionsBuilder());
+
             for (QNodeTypeDefinition qdef: r.getNodeTypeDefinitions()) {
                 add(new NodeTypeDef(qdef));
             }

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java?rev=814651&r1=814650&r2=814651&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
(original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
Mon Sep 14 14:15:34 2009
@@ -50,6 +50,8 @@
 import org.apache.commons.collections.map.ReferenceMap;
 import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
 import org.apache.jackrabbit.commons.NamespaceHelper;
+import org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader;
+import org.apache.jackrabbit.commons.cnd.ParseException;
 import org.apache.jackrabbit.commons.iterator.NodeTypeIteratorAdapter;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.data.DataStore;
@@ -67,8 +69,7 @@
 import org.apache.jackrabbit.spi.commons.nodetype.*;
 import org.apache.jackrabbit.spi.commons.nodetype.NodeDefinitionImpl;
 import org.apache.jackrabbit.spi.commons.nodetype.PropertyDefinitionImpl;
-import org.apache.jackrabbit.spi.commons.nodetype.compact.CompactNodeTypeDefReader;
-import org.apache.jackrabbit.spi.commons.nodetype.compact.ParseException;
+import org.apache.jackrabbit.spi.commons.nodetype.QItemDefinitionsBuilder;
 import org.apache.jackrabbit.spi.commons.nodetype.constraint.ValueConstraint;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.commons.QPropertyDefinitionImpl;
@@ -208,7 +209,7 @@
     }
 
     /**
-     * @see org.apache.jackrabbit.spi.commons.nodetype.AbstractNodeTypeManager#getNamePathResolver()

+     * @see org.apache.jackrabbit.spi.commons.nodetype.AbstractNodeTypeManager#getNamePathResolver()
      */
     public NamePathResolver getNamePathResolver() {
         return session;
@@ -267,8 +268,11 @@
             } else if (contentType.equalsIgnoreCase(TEXT_X_JCR_CND)) {
                 try {
                     NamespaceMapping mapping = new NamespaceMapping(session);
-                    CompactNodeTypeDefReader reader = new CompactNodeTypeDefReader(
-                            new InputStreamReader(in), "cnd input stream", mapping);
+
+                    CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping>
reader =
+                        new CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping>(
+                            new InputStreamReader(in), "cnd input stream", mapping,
+                            new QItemDefinitionsBuilder());
 
                     namespaceMap.putAll(mapping.getPrefixToURIMapping());
                     for (QNodeTypeDefinition ntDef: reader.getNodeTypeDefinitions()) {

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateProvider.java?rev=814651&r1=814650&r2=814651&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateProvider.java
(original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateProvider.java
Mon Sep 14 14:15:34 2009
@@ -25,7 +25,6 @@
 import javax.jcr.version.OnParentVersionAction;
 
 import org.apache.jackrabbit.core.id.NodeId;
-import org.apache.jackrabbit.core.nodetype.NodeDefId;
 import org.apache.jackrabbit.core.nodetype.NodeTypeDef;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.core.state.ChangeLog;

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java?rev=814651&r1=814650&r2=814651&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java
(original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java
Mon Sep 14 14:15:34 2009
@@ -24,7 +24,6 @@
 import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.data.DataStore;
-import org.apache.jackrabbit.core.nodetype.NodeDefId;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
 

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/Serializer.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/Serializer.java?rev=814651&r1=814650&r2=814651&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/Serializer.java
(original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/Serializer.java
Mon Sep 14 14:15:34 2009
@@ -20,8 +20,6 @@
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.fs.FileSystemResource;
-import org.apache.jackrabbit.core.nodetype.NodeDefId;
-import org.apache.jackrabbit.core.nodetype.PropDefId;
 import org.apache.jackrabbit.core.state.NodeReferences;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/NodeTypeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/NodeTypeTest.java?rev=814651&r1=814650&r2=814651&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/NodeTypeTest.java
(original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/NodeTypeTest.java
Mon Sep 14 14:15:34 2009
@@ -16,17 +16,21 @@
  */
 package org.apache.jackrabbit.core.data;
 
-import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
-import org.apache.jackrabbit.test.AbstractJCRTest;
-
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
 
 import javax.jcr.Node;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
 
+import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
+import org.apache.jackrabbit.commons.cnd.CndImporter;
+import org.apache.jackrabbit.commons.cnd.ParseException;
+import org.apache.jackrabbit.test.AbstractJCRTest;
+
 /**
  * Test node types with binary default values.
  */
@@ -35,16 +39,18 @@
     /**
      * Test a node type with a binary default value
      * @throws RepositoryException
+     * @throws ParseException
      */
     public void testNodeTypesWithBinaryDefaultValue()
-            throws RepositoryException, IOException {
+            throws RepositoryException, IOException, ParseException {
+
         doTestNodeTypesWithBinaryDefaultValue(0);
         doTestNodeTypesWithBinaryDefaultValue(10);
         doTestNodeTypesWithBinaryDefaultValue(10000);
     }
 
     public void doTestNodeTypesWithBinaryDefaultValue(int len)
-            throws RepositoryException, IOException {
+            throws RepositoryException, IOException, ParseException {
         char[] chars = new char[len];
         for (int i = 0; i < chars.length; i++) {
             chars[i] = 'a';
@@ -58,9 +64,8 @@
         JackrabbitNodeTypeManager manager = (JackrabbitNodeTypeManager)
             superuser.getWorkspace().getNodeTypeManager();
         if (!manager.hasNodeType(type)) {
-            manager.registerNodeTypes(
-                    new ByteArrayInputStream(cnd.getBytes("UTF-8")),
-                    JackrabbitNodeTypeManager.TEXT_X_JCR_CND);
+            Reader cndReader = new InputStreamReader(new ByteArrayInputStream(cnd.getBytes("UTF-8")));
+            CndImporter.registerNodeTypes(cndReader, superuser);
         }
 
         Node root = superuser.getRootNode();

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/TestAll.java?rev=814651&r1=814650&r2=814651&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/TestAll.java
(original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/TestAll.java
Mon Sep 14 14:15:34 2009
@@ -16,13 +16,27 @@
  */
 package org.apache.jackrabbit.core.nodetype.xml;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.Arrays;
+
+import javax.jcr.NamespaceException;
+import javax.jcr.NamespaceRegistry;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.version.OnParentVersionAction;
+
 import junit.framework.AssertionFailedError;
 
 import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
+import org.apache.jackrabbit.commons.cnd.CndImporter;
 import org.apache.jackrabbit.core.nodetype.InvalidNodeTypeDefException;
 import org.apache.jackrabbit.core.nodetype.NodeTypeDef;
 import org.apache.jackrabbit.core.value.InternalValueFactory;
-import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.NameFactory;
 import org.apache.jackrabbit.spi.QValue;
@@ -32,20 +46,10 @@
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
+import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
 import org.apache.jackrabbit.spi.commons.value.ValueFactoryQImpl;
 import org.apache.jackrabbit.test.AbstractJCRTest;
 
-import javax.jcr.NamespaceException;
-import javax.jcr.NamespaceRegistry;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import javax.jcr.version.OnParentVersionAction;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Arrays;
-
 /**
  * Test cases for reading and writing node type definition files.
  */
@@ -285,11 +289,9 @@
             superuser.getNamespacePrefix("test-namespace3");
             // Ignore test case, node type and namespace already registered
         } catch (NamespaceException e1) {
-            JackrabbitNodeTypeManager ntm = (JackrabbitNodeTypeManager)
-                superuser.getWorkspace().getNodeTypeManager();
-            ntm.registerNodeTypes(
-                    TestAll.class.getResourceAsStream(TEST_NS_CND_NODETYPES),
-                    JackrabbitNodeTypeManager.TEXT_X_JCR_CND);
+            Reader cnd = new InputStreamReader(TestAll.class.getResourceAsStream(TEST_NS_CND_NODETYPES));
+            CndImporter.registerNodeTypes(cnd, superuser);
+            cnd.close();
             try {
                 superuser.getNamespacePrefix("test-namespace3");
             } catch (NamespaceException e2) {

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/MixinTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/MixinTest.java?rev=814651&r1=814650&r2=814651&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/MixinTest.java
(original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/MixinTest.java
Mon Sep 14 14:15:34 2009
@@ -16,19 +16,23 @@
  */
 package org.apache.jackrabbit.core.query;
 
-import javax.jcr.RepositoryException;
+import java.io.ByteArrayInputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.Calendar;
+
 import javax.jcr.Node;
+import javax.jcr.RepositoryException;
 
 import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
-
-import java.io.ByteArrayInputStream;
-import java.util.Calendar;
+import org.apache.jackrabbit.commons.cnd.CndImporter;
 
 /**
  * Tests if mixin types are queried correctly when using element test: element()
  */
 public class MixinTest extends AbstractQueryTest {
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
 
@@ -38,9 +42,9 @@
             String cnd =
                 "<test='http://www.apache.org/jackrabbit/test'>\n"
                 + "[test:mimeType] > mix:mimeType mixin";
-            manager.registerNodeTypes(
-                    new ByteArrayInputStream(cnd.getBytes()),
-                    JackrabbitNodeTypeManager.TEXT_X_JCR_CND);
+
+            Reader cndReader = new InputStreamReader(new ByteArrayInputStream(cnd.getBytes()));
+            CndImporter.registerNodeTypes(cndReader, superuser);
         }
     }
 

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/DocumentViewTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/DocumentViewTest.java?rev=814651&r1=814650&r2=814651&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/DocumentViewTest.java
(original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/DocumentViewTest.java
Mon Sep 14 14:15:34 2009
@@ -19,6 +19,8 @@
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
 
 import javax.jcr.ImportUUIDBehavior;
 import javax.jcr.Node;
@@ -28,6 +30,7 @@
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 
 import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
+import org.apache.jackrabbit.commons.cnd.CndImporter;
 import org.apache.jackrabbit.test.AbstractJCRTest;
 
 /**
@@ -43,6 +46,7 @@
      *
      * @throws Exception if an unexpected error occurs
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         JackrabbitNodeTypeManager manager = (JackrabbitNodeTypeManager)
@@ -51,9 +55,8 @@
             manager.getNodeType("DocViewMultiValueTest");
         } catch (NoSuchNodeTypeException e) {
             String cnd = "[DocViewMultiValueTest] - test (boolean) multiple";
-            manager.registerNodeTypes(
-                    new ByteArrayInputStream(cnd.getBytes("UTF-8")),
-                    JackrabbitNodeTypeManager.TEXT_X_JCR_CND);
+            Reader cndReader = new InputStreamReader(new ByteArrayInputStream(cnd.getBytes("UTF-8")));
+            CndImporter.registerNodeTypes(cndReader, superuser);
         }
     }
 
@@ -62,6 +65,7 @@
      *
      * @throws Exception if an unexpected error occurs
      */
+    @Override
     protected void tearDown() throws Exception {
         // TODO: Unregister the MultiValueTestType node type once Jackrabbit
         // supports node type removal.

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/AbstractJCR2SPITest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/AbstractJCR2SPITest.java?rev=814651&r1=814650&r2=814651&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/AbstractJCR2SPITest.java
(original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/AbstractJCR2SPITest.java
Mon Sep 14 14:15:34 2009
@@ -37,6 +37,7 @@
 
 import junit.framework.TestCase;
 
+import org.apache.jackrabbit.commons.cnd.ParseException;
 import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig;
 import org.apache.jackrabbit.spi.Batch;
 import org.apache.jackrabbit.spi.ChildInfo;
@@ -64,7 +65,6 @@
 import org.apache.jackrabbit.spi.SessionInfo;
 import org.apache.jackrabbit.spi.Subscription;
 import org.apache.jackrabbit.spi.commons.AbstractReadableRepositoryService;
-import org.apache.jackrabbit.spi.commons.nodetype.compact.ParseException;
 import org.apache.jackrabbit.spi.commons.value.QValueFactoryImpl;
 
 /**

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java?rev=814651&r1=814650&r2=814651&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java
(original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java
Mon Sep 14 14:15:34 2009
@@ -32,13 +32,13 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.UnsupportedRepositoryOperationException;
 
+import org.apache.jackrabbit.commons.cnd.ParseException;
 import org.apache.jackrabbit.spi.ItemId;
 import org.apache.jackrabbit.spi.ItemInfo;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.NodeInfo;
 import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.spi.SessionInfo;
-import org.apache.jackrabbit.spi.commons.nodetype.compact.ParseException;
 
 /**
  * <code>AbstractReadableRepositoryService</code> provides an abstract base

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractRepositoryService.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractRepositoryService.java?rev=814651&r1=814650&r2=814651&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractRepositoryService.java
(original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractRepositoryService.java
Mon Sep 14 14:15:34 2009
@@ -48,6 +48,8 @@
 import javax.jcr.query.InvalidQueryException;
 import javax.jcr.version.VersionException;
 
+import org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader;
+import org.apache.jackrabbit.commons.cnd.ParseException;
 import org.apache.jackrabbit.spi.Batch;
 import org.apache.jackrabbit.spi.EventBundle;
 import org.apache.jackrabbit.spi.EventFilter;
@@ -75,8 +77,7 @@
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceMapping;
 import org.apache.jackrabbit.spi.commons.nodetype.NodeTypeStorage;
 import org.apache.jackrabbit.spi.commons.nodetype.NodeTypeStorageImpl;
-import org.apache.jackrabbit.spi.commons.nodetype.compact.CompactNodeTypeDefReader;
-import org.apache.jackrabbit.spi.commons.nodetype.compact.ParseException;
+import org.apache.jackrabbit.spi.commons.nodetype.QItemDefinitionsBuilder;
 import org.apache.jackrabbit.spi.commons.value.QValueFactoryImpl;
 
 /**
@@ -205,9 +206,11 @@
             this.namespaces.setMapping(entry.getKey(), entry.getValue());
         }
 
-        CompactNodeTypeDefReader reader;
+        CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping> reader;
         try {
-            reader = new CompactNodeTypeDefReader(cnd, "", this.namespaces);
+            reader = new CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping>(cnd,
"",
+                    this.namespaces, new QItemDefinitionsBuilder());
+
             List<QNodeTypeDefinition> ntds = reader.getNodeTypeDefinitions();
             nodeTypeDefs.registerNodeTypes(ntds.toArray(new QNodeTypeDefinition[ntds.size()]),
true);
         }

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/CompactNodeTypeDefWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/CompactNodeTypeDefWriter.java?rev=814651&r1=814650&r2=814651&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/CompactNodeTypeDefWriter.java
(original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/compact/CompactNodeTypeDefWriter.java
Mon Sep 14 14:15:34 2009
@@ -36,6 +36,7 @@
 import javax.jcr.query.qom.QueryObjectModelConstants;
 import javax.jcr.version.OnParentVersionAction;
 
+import org.apache.jackrabbit.commons.cnd.Lexer;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.QNodeTypeDefinition;

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/nodetype/compact/CompactNodeTypeDefTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/nodetype/compact/CompactNodeTypeDefTest.java?rev=814651&r1=814650&r2=814651&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/nodetype/compact/CompactNodeTypeDefTest.java
(original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/nodetype/compact/CompactNodeTypeDefTest.java
Mon Sep 14 14:15:34 2009
@@ -23,13 +23,15 @@
 import java.io.StringWriter;
 import java.util.List;
 
+import junit.framework.TestCase;
+
+import org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader;
 import org.apache.jackrabbit.spi.QNodeTypeDefinition;
 import org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceMapping;
 import org.apache.jackrabbit.spi.commons.nodetype.NodeTypeDefDiff;
-
-import junit.framework.TestCase;
+import org.apache.jackrabbit.spi.commons.nodetype.QItemDefinitionsBuilder;
 
 public class CompactNodeTypeDefTest extends TestCase {
 
@@ -39,7 +41,9 @@
 
         // Read in node type def from test file
         Reader reader = new InputStreamReader(getClass().getClassLoader().getResourceAsStream(TEST_FILE));
-        CompactNodeTypeDefReader cndReader = new CompactNodeTypeDefReader(reader, TEST_FILE);
+        CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping> cndReader =
+            new CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping>(
+                reader, TEST_FILE, new QItemDefinitionsBuilder());
 
         List<QNodeTypeDefinition> ntdList1 = cndReader.getNodeTypeDefinitions();
         NamespaceMapping nsm = cndReader.getNamespaceMapping();
@@ -50,7 +54,8 @@
         CompactNodeTypeDefWriter.write(ntdList1, nsm, resolver, sw);
 
         // Rerun the reader on the product of the writer
-        cndReader = new CompactNodeTypeDefReader(new StringReader(sw.toString()), TEST_FILE);
+        cndReader = new CompactNodeTypeDefReader<QNodeTypeDefinition, NamespaceMapping>(
+                new StringReader(sw.toString()), TEST_FILE, new QItemDefinitionsBuilder());
 
         List<QNodeTypeDefinition> ntdList2 = cndReader.getNodeTypeDefinitions();
 



Mime
View raw message