jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r792142 [26/35] - in /jackrabbit/sandbox/JCR-1456: ./ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/ jackrabbit-core/ jackrabbit-core/src/main/java/org/apache/jackrab...
Date Wed, 08 Jul 2009 13:57:46 GMT
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/RestoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/RestoreTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/RestoreTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/RestoreTest.java Wed Jul  8 13:57:13 2009
@@ -23,7 +23,11 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.nodetype.NodeDefinition;
-import javax.jcr.version.*;
+import javax.jcr.version.OnParentVersionAction;
+import javax.jcr.version.Version;
+import javax.jcr.version.VersionException;
+import javax.jcr.version.VersionIterator;
+import javax.jcr.version.VersionManager;
 
 import org.apache.jackrabbit.test.NotExecutableException;
 
@@ -884,12 +888,11 @@
      * Test the restore of the OPV=Version child nodes.
      * @throws RepositoryException
      */
-    public void testRestoreName() throws RepositoryException {
+    public void testRestoreName() throws RepositoryException,
+            NotExecutableException {
         // V1.0 of versionableNode has no child
         Node child1 = versionableNode.addNode(nodeName4);
-        if (!child1.isNodeType(mixVersionable)) {
-            child1.addMixin(mixVersionable);
-        }
+        ensureMixinType(child1, mixVersionable);
         versionableNode.getSession().save();
         // create v1.0 of child
         Version v1Child = child1.checkin();
@@ -925,12 +928,11 @@
      * Test the restore of the OPV=Version child nodes.
      * @throws RepositoryException
      */
-    public void testRestoreNameJcr2() throws RepositoryException {
+    public void testRestoreNameJcr2() throws RepositoryException,
+            NotExecutableException {
         // V1.0 of versionableNode has no child
         Node child1 = versionableNode.addNode(nodeName4);
-        if (!child1.isNodeType(mixVersionable)) {
-            child1.addMixin(mixVersionable);
-        }
+        ensureMixinType(child1, mixVersionable);
         versionableNode.getSession().save();
         // create v1.0 of child
         Version v1Child = child1.checkin();
@@ -966,21 +968,18 @@
      * Test the child ordering of restored nodes.
      * @throws RepositoryException
      */
-    public void testRestoreOrder() throws RepositoryException {
+    public void testRestoreOrder() throws RepositoryException,
+            NotExecutableException {
         // create a test-root that has orderable child nodes
         Node testRoot = versionableNode.addNode(nodeName4, "nt:unstructured");
-        testRoot.addMixin(mixVersionable);
+        ensureMixinType(testRoot, mixVersionable);
         versionableNode.getSession().save();
 
         // create children of vNode and checkin
         Node child1 = testRoot.addNode(nodeName1);
-        if (!child1.isNodeType(mixVersionable)) {
-            child1.addMixin(mixVersionable);
-        }
+        ensureMixinType(child1, mixVersionable);
         Node child2 = testRoot.addNode(nodeName2);
-        if (!child2.isNodeType(mixVersionable)) {
-            child2.addMixin(mixVersionable);
-        }
+        ensureMixinType(child2, mixVersionable);
         testRoot.getSession().save();
         child1.checkin();
         child2.checkin();
@@ -1010,21 +1009,18 @@
      * Test the child ordering of restored nodes.
      * @throws RepositoryException
      */
-    public void testRestoreOrderJcr2() throws RepositoryException {
+    public void testRestoreOrderJcr2() throws RepositoryException,
+            NotExecutableException {
         // create a test-root that has orderable child nodes
         Node testRoot = versionableNode.addNode(nodeName4, "nt:unstructured");
-        testRoot.addMixin(mixVersionable);
+        ensureMixinType(testRoot, mixVersionable);
         versionableNode.getSession().save();
 
         // create children of vNode and checkin
         Node child1 = testRoot.addNode(nodeName1);
-        if (!child1.isNodeType(mixVersionable)) {
-            child1.addMixin(mixVersionable);
-        }
+        ensureMixinType(child1, mixVersionable);
         Node child2 = testRoot.addNode(nodeName2);
-        if (!child2.isNodeType(mixVersionable)) {
-            child2.addMixin(mixVersionable);
-        }
+        ensureMixinType(child2, mixVersionable);
         testRoot.getSession().save();
         versionManager.checkin(child1.getPath());
         versionManager.checkin(child2.getPath());
@@ -1054,21 +1050,18 @@
      * Test the child ordering of restored nodes.
      * @throws RepositoryException
      */
-    public void testRestoreOrderJcr2_2() throws RepositoryException {
+    public void testRestoreOrderJcr2_2() throws RepositoryException,
+            NotExecutableException {
         // create a test-root that has orderable child nodes
         Node testRoot = versionableNode.addNode(nodeName4, "nt:unstructured");
-        testRoot.addMixin(mixVersionable);
+        ensureMixinType(testRoot, mixVersionable);
         versionableNode.getSession().save();
 
         // create children of vNode and checkin
         Node child1 = testRoot.addNode(nodeName1);
-        if (!child1.isNodeType(mixVersionable)) {
-            child1.addMixin(mixVersionable);
-        }
+        ensureMixinType(child1, mixVersionable);
         Node child2 = testRoot.addNode(nodeName2);
-        if (!child2.isNodeType(mixVersionable)) {
-            child2.addMixin(mixVersionable);
-        }
+        ensureMixinType(child2, mixVersionable);
         testRoot.getSession().save();
         versionManager.checkin(child1.getPath());
         versionManager.checkin(child2.getPath());
@@ -1098,21 +1091,18 @@
      * Test the child ordering of restored nodes.
      * @throws RepositoryException
      */
-    public void testRestoreOrderJcr2_3() throws RepositoryException {
+    public void testRestoreOrderJcr2_3() throws RepositoryException,
+            NotExecutableException {
         // create a test-root that has orderable child nodes
         Node testRoot = versionableNode.addNode(nodeName4, "nt:unstructured");
-        testRoot.addMixin(mixVersionable);
+        ensureMixinType(testRoot, mixVersionable);
         versionableNode.getSession().save();
 
         // create children of vNode and checkin
         Node child1 = testRoot.addNode(nodeName1);
-        if (!child1.isNodeType(mixVersionable)) {
-            child1.addMixin(mixVersionable);
-        }
+        ensureMixinType(child1, mixVersionable);
         Node child2 = testRoot.addNode(nodeName2);
-        if (!child2.isNodeType(mixVersionable)) {
-            child2.addMixin(mixVersionable);
-        }
+        ensureMixinType(child2, mixVersionable);
         testRoot.getSession().save();
         versionManager.checkin(child1.getPath());
         versionManager.checkin(child2.getPath());
@@ -1142,21 +1132,18 @@
      * Test the child ordering of restored nodes.
      * @throws RepositoryException
      */
-    public void testRestoreOrderJcr2_4() throws RepositoryException {
+    public void testRestoreOrderJcr2_4() throws RepositoryException,
+            NotExecutableException {
         // create a test-root that has orderable child nodes
         Node testRoot = versionableNode.addNode(nodeName4, "nt:unstructured");
-        testRoot.addMixin(mixVersionable);
+        ensureMixinType(testRoot, mixVersionable);
         versionableNode.getSession().save();
 
         // create children of vNode and checkin
         Node child1 = testRoot.addNode(nodeName1);
-        if (!child1.isNodeType(mixVersionable)) {
-            child1.addMixin(mixVersionable);
-        }
+        ensureMixinType(child1, mixVersionable);
         Node child2 = testRoot.addNode(nodeName2);
-        if (!child2.isNodeType(mixVersionable)) {
-            child2.addMixin(mixVersionable);
-        }
+        ensureMixinType(child2, mixVersionable);
         testRoot.getSession().save();
         versionManager.checkin(child1.getPath());
         versionManager.checkin(child2.getPath());
@@ -1186,21 +1173,18 @@
      * Test the child ordering of restored nodes.
      * @throws RepositoryException
      */
-    public void testRestoreOrder2() throws RepositoryException {
+    public void testRestoreOrder2() throws RepositoryException,
+            NotExecutableException {
         // create a test-root that has orderable child nodes
         Node testRoot = versionableNode.addNode(nodeName4, "nt:unstructured");
-        testRoot.addMixin(mixVersionable);
+        ensureMixinType(testRoot, mixVersionable);
         versionableNode.getSession().save();
 
         // create children of vNode and checkin
         Node child1 = testRoot.addNode(nodeName1);
-        if (!child1.isNodeType(mixVersionable)) {
-            child1.addMixin(mixVersionable);
-        }
+        ensureMixinType(child1, mixVersionable);
         Node child2 = testRoot.addNode(nodeName2);
-        if (!child2.isNodeType(mixVersionable)) {
-            child2.addMixin(mixVersionable);
-        }
+        ensureMixinType(child2, mixVersionable);
         testRoot.getSession().save();
         child1.checkin();
         child2.checkin();
@@ -1230,21 +1214,18 @@
      * Test the child ordering of restored nodes.
      * @throws RepositoryException
      */
-    public void testRestoreOrder2Jcr2() throws RepositoryException {
+    public void testRestoreOrder2Jcr2() throws RepositoryException,
+            NotExecutableException {
         // create a test-root that has orderable child nodes
         Node testRoot = versionableNode.addNode(nodeName4, "nt:unstructured");
-        testRoot.addMixin(mixVersionable);
+        ensureMixinType(testRoot, mixVersionable);
         versionableNode.getSession().save();
 
         // create children of vNode and checkin
         Node child1 = testRoot.addNode(nodeName1);
-        if (!child1.isNodeType(mixVersionable)) {
-            child1.addMixin(mixVersionable);
-        }
+        ensureMixinType(child1, mixVersionable);
         Node child2 = testRoot.addNode(nodeName2);
-        if (!child2.isNodeType(mixVersionable)) {
-            child2.addMixin(mixVersionable);
-        }
+        ensureMixinType(child2, mixVersionable);
         testRoot.getSession().save();
         versionManager.checkin(child1.getPath());
         versionManager.checkin(child2.getPath());
@@ -1274,21 +1255,18 @@
      * Test the child ordering of restored nodes.
      * @throws RepositoryException
      */
-    public void testRestoreOrder2Jcr2_2() throws RepositoryException {
+    public void testRestoreOrder2Jcr2_2() throws RepositoryException,
+            NotExecutableException {
         // create a test-root that has orderable child nodes
         Node testRoot = versionableNode.addNode(nodeName4, "nt:unstructured");
-        testRoot.addMixin(mixVersionable);
+        ensureMixinType(testRoot, mixVersionable);
         versionableNode.getSession().save();
 
         // create children of vNode and checkin
         Node child1 = testRoot.addNode(nodeName1);
-        if (!child1.isNodeType(mixVersionable)) {
-            child1.addMixin(mixVersionable);
-        }
+        ensureMixinType(child1, mixVersionable);
         Node child2 = testRoot.addNode(nodeName2);
-        if (!child2.isNodeType(mixVersionable)) {
-            child2.addMixin(mixVersionable);
-        }
+        ensureMixinType(child2, mixVersionable);
         testRoot.getSession().save();
         versionManager.checkin(child1.getPath());
         versionManager.checkin(child2.getPath());
@@ -1318,21 +1296,18 @@
      * Test the child ordering of restored nodes.
      * @throws RepositoryException
      */
-    public void testRestoreOrder2Jcr2_3() throws RepositoryException {
+    public void testRestoreOrder2Jcr2_3() throws RepositoryException,
+            NotExecutableException {
         // create a test-root that has orderable child nodes
         Node testRoot = versionableNode.addNode(nodeName4, "nt:unstructured");
-        testRoot.addMixin(mixVersionable);
+        ensureMixinType(testRoot, mixVersionable);
         versionableNode.getSession().save();
 
         // create children of vNode and checkin
         Node child1 = testRoot.addNode(nodeName1);
-        if (!child1.isNodeType(mixVersionable)) {
-            child1.addMixin(mixVersionable);
-        }
+        ensureMixinType(child1, mixVersionable);
         Node child2 = testRoot.addNode(nodeName2);
-        if (!child2.isNodeType(mixVersionable)) {
-            child2.addMixin(mixVersionable);
-        }
+        ensureMixinType(child2, mixVersionable);
         testRoot.getSession().save();
         versionManager.checkin(child1.getPath());
         versionManager.checkin(child2.getPath());
@@ -1362,21 +1337,18 @@
      * Test the child ordering of restored nodes.
      * @throws RepositoryException
      */
-    public void testRestoreOrder2Jcr2_4() throws RepositoryException {
+    public void testRestoreOrder2Jcr2_4() throws RepositoryException,
+            NotExecutableException {
         // create a test-root that has orderable child nodes
         Node testRoot = versionableNode.addNode(nodeName4, "nt:unstructured");
-        testRoot.addMixin(mixVersionable);
+        ensureMixinType(testRoot, mixVersionable);
         versionableNode.getSession().save();
 
         // create children of vNode and checkin
         Node child1 = testRoot.addNode(nodeName1);
-        if (!child1.isNodeType(mixVersionable)) {
-            child1.addMixin(mixVersionable);
-        }
+        ensureMixinType(child1, mixVersionable);
         Node child2 = testRoot.addNode(nodeName2);
-        if (!child2.isNodeType(mixVersionable)) {
-            child2.addMixin(mixVersionable);
-        }
+        ensureMixinType(child2, mixVersionable);
         testRoot.getSession().save();
         versionManager.checkin(child1.getPath());
         versionManager.checkin(child2.getPath());

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-childNodeDefinition.txt
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-childNodeDefinition.txt?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-childNodeDefinition.txt (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-childNodeDefinition.txt Wed Jul  8 13:57:13 2009
@@ -15,7 +15,7 @@
   AutoCreated false
   Mandatory true
   OnParentVersion COPY
-  Protected false
+  Protected true
   Multiple false
 PropertyDefinition
   Name jcr:defaultPrimaryType
@@ -24,7 +24,7 @@
   AutoCreated false
   Mandatory false
   OnParentVersion COPY
-  Protected false
+  Protected true
   Multiple false
 PropertyDefinition
   Name jcr:mandatory
@@ -33,7 +33,7 @@
   AutoCreated false
   Mandatory true
   OnParentVersion COPY
-  Protected false
+  Protected true
   Multiple false
 PropertyDefinition
   Name jcr:name
@@ -42,7 +42,7 @@
   AutoCreated false
   Mandatory false
   OnParentVersion COPY
-  Protected false
+  Protected true
   Multiple false
 PropertyDefinition
   Name jcr:onParentVersion
@@ -51,7 +51,7 @@
   AutoCreated false
   Mandatory true
   OnParentVersion COPY
-  Protected false
+  Protected true
   Multiple false
 PropertyDefinition
   Name jcr:protected
@@ -60,7 +60,7 @@
   AutoCreated false
   Mandatory true
   OnParentVersion COPY
-  Protected false
+  Protected true
   Multiple false
 PropertyDefinition
   Name jcr:requiredPrimaryTypes
@@ -69,7 +69,7 @@
   AutoCreated false
   Mandatory true
   OnParentVersion COPY
-  Protected false
+  Protected true
   Multiple true
 PropertyDefinition
   Name jcr:sameNameSiblings
@@ -78,5 +78,5 @@
   AutoCreated false
   Mandatory true
   OnParentVersion COPY
-  Protected false
-  Multiple false
+  Protected true
+  Multiple false
\ No newline at end of file

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-hierarchyNode.txt
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-hierarchyNode.txt?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-hierarchyNode.txt (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-hierarchyNode.txt Wed Jul  8 13:57:13 2009
@@ -2,18 +2,10 @@
   nt:hierarchyNode
 Supertypes
   nt:base
+  mix:created
 IsMixin
   false
 HasOrderableChildNodes
   false
 PrimaryItemName
-  null
-PropertyDefinition
-  Name jcr:created
-  RequiredType DATE
-  DefaultValues null
-  AutoCreated true
-  Mandatory false
-  OnParentVersion INITIALIZE
-  Protected true
-  Multiple false
+  null
\ No newline at end of file

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-nodeType.txt
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-nodeType.txt?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-nodeType.txt (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-nodeType.txt Wed Jul  8 13:57:13 2009
@@ -14,8 +14,8 @@
   DefaultPrimaryType nt:childNodeDefinition
   AutoCreated false
   Mandatory false
-  OnParentVersion VERSION
-  Protected false
+  OnParentVersion COPY
+  Protected true
   SameNameSiblings true
 ChildNodeDefinition
   Name jcr:propertyDefinition
@@ -23,8 +23,8 @@
   DefaultPrimaryType nt:propertyDefinition
   AutoCreated false
   Mandatory false
-  OnParentVersion VERSION
-  Protected false
+  OnParentVersion COPY
+  Protected true
   SameNameSiblings true
 PropertyDefinition
   Name jcr:hasOrderableChildNodes
@@ -33,7 +33,16 @@
   AutoCreated false
   Mandatory true
   OnParentVersion COPY
-  Protected false
+  Protected true
+  Multiple false
+PropertyDefinition
+  Name jcr:isAbstract
+  RequiredType BOOLEAN
+  DefaultValues null
+  AutoCreated false
+  Mandatory true
+  OnParentVersion COPY
+  Protected true
   Multiple false
 PropertyDefinition
   Name jcr:isMixin
@@ -42,7 +51,16 @@
   AutoCreated false
   Mandatory true
   OnParentVersion COPY
-  Protected false
+  Protected true
+  Multiple false
+PropertyDefinition
+  Name jcr:isQueryable
+  RequiredType BOOLEAN
+  DefaultValues null
+  AutoCreated false
+  Mandatory true
+  OnParentVersion COPY
+  Protected true
   Multiple false
 PropertyDefinition
   Name jcr:nodeTypeName
@@ -51,7 +69,7 @@
   AutoCreated false
   Mandatory true
   OnParentVersion COPY
-  Protected false
+  Protected true
   Multiple false
 PropertyDefinition
   Name jcr:primaryItemName
@@ -60,7 +78,7 @@
   AutoCreated false
   Mandatory false
   OnParentVersion COPY
-  Protected false
+  Protected true
   Multiple false
 PropertyDefinition
   Name jcr:supertypes
@@ -69,5 +87,5 @@
   AutoCreated false
   Mandatory false
   OnParentVersion COPY
-  Protected false
-  Multiple true
+  Protected true
+  Multiple true
\ No newline at end of file

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-propertyDefinition.txt
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-propertyDefinition.txt?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-propertyDefinition.txt (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-propertyDefinition.txt Wed Jul  8 13:57:13 2009
@@ -15,25 +15,52 @@
   AutoCreated false
   Mandatory true
   OnParentVersion COPY
-  Protected false
+  Protected true
   Multiple false
 PropertyDefinition
+  Name jcr:availableQueryOperators
+  RequiredType NAME
+  DefaultValues null
+  AutoCreated false
+  Mandatory true
+  OnParentVersion COPY
+  Protected true
+  Multiple true
+PropertyDefinition
   Name jcr:defaultValues
   RequiredType UNDEFINED
   DefaultValues null
   AutoCreated false
   Mandatory false
   OnParentVersion COPY
-  Protected false
+  Protected true
   Multiple true
 PropertyDefinition
+  Name jcr:isFullTextSearchable
+  RequiredType BOOLEAN
+  DefaultValues null
+  AutoCreated false
+  Mandatory true
+  OnParentVersion COPY
+  Protected true
+  Multiple false
+PropertyDefinition
+  Name jcr:isQueryOrderable
+  RequiredType BOOLEAN
+  DefaultValues null
+  AutoCreated false
+  Mandatory true
+  OnParentVersion COPY
+  Protected true
+  Multiple false
+PropertyDefinition
   Name jcr:mandatory
   RequiredType BOOLEAN
   DefaultValues null
   AutoCreated false
   Mandatory true
   OnParentVersion COPY
-  Protected false
+  Protected true
   Multiple false
 PropertyDefinition
   Name jcr:multiple
@@ -42,7 +69,7 @@
   AutoCreated false
   Mandatory true
   OnParentVersion COPY
-  Protected false
+  Protected true
   Multiple false
 PropertyDefinition
   Name jcr:name
@@ -51,7 +78,7 @@
   AutoCreated false
   Mandatory false
   OnParentVersion COPY
-  Protected false
+  Protected true
   Multiple false
 PropertyDefinition
   Name jcr:onParentVersion
@@ -60,7 +87,7 @@
   AutoCreated false
   Mandatory true
   OnParentVersion COPY
-  Protected false
+  Protected true
   Multiple false
 PropertyDefinition
   Name jcr:protected
@@ -69,7 +96,7 @@
   AutoCreated false
   Mandatory true
   OnParentVersion COPY
-  Protected false
+  Protected true
   Multiple false
 PropertyDefinition
   Name jcr:requiredType
@@ -78,7 +105,7 @@
   AutoCreated false
   Mandatory true
   OnParentVersion COPY
-  Protected false
+  Protected true
   Multiple false
 PropertyDefinition
   Name jcr:valueConstraints
@@ -87,5 +114,5 @@
   AutoCreated false
   Mandatory false
   OnParentVersion COPY
-  Protected false
-  Multiple true
+  Protected true
+  Multiple true
\ No newline at end of file

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-resource.txt
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-resource.txt?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-resource.txt (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-resource.txt Wed Jul  8 13:57:13 2009
@@ -2,7 +2,8 @@
   nt:resource
 Supertypes
   nt:base
-  mix:referenceable
+  mix:lastModified
+  mix:mimeType
 IsMixin
   false
 HasOrderableChildNodes
@@ -17,31 +18,4 @@
   Mandatory true
   OnParentVersion COPY
   Protected false
-  Multiple false
-PropertyDefinition
-  Name jcr:encoding
-  RequiredType STRING
-  DefaultValues null
-  AutoCreated false
-  Mandatory false
-  OnParentVersion COPY
-  Protected false
-  Multiple false
-PropertyDefinition
-  Name jcr:lastModified
-  RequiredType DATE
-  DefaultValues null
-  AutoCreated false
-  Mandatory true
-  OnParentVersion IGNORE
-  Protected false
-  Multiple false
-PropertyDefinition
-  Name jcr:mimeType
-  RequiredType STRING
-  DefaultValues null
-  AutoCreated false
-  Mandatory true
-  OnParentVersion COPY
-  Protected false
-  Multiple false
+  Multiple false
\ No newline at end of file

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-versionHistory.txt
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-versionHistory.txt?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-versionHistory.txt (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-versionHistory.txt Wed Jul  8 13:57:13 2009
@@ -37,6 +37,15 @@
   Protected true
   SameNameSiblings false
 PropertyDefinition
+  Name jcr:copiedFrom
+  RequiredType WEAKREFERENCE
+  DefaultValues null
+  AutoCreated false
+  Mandatory false
+  OnParentVersion ABORT
+  Protected true
+  Multiple false
+PropertyDefinition
   Name jcr:versionableUuid
   RequiredType STRING
   DefaultValues null

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/pom.xml?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/pom.xml (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/pom.xml Wed Jul  8 13:57:13 2009
@@ -48,14 +48,18 @@
   <build>
     <plugins>
       <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
+        <artifactId>maven-assembly-plugin</artifactId>
         <executions>
           <execution>
+            <phase>package</phase>
             <goals>
-              <goal>jar</goal>
-              <goal>test-jar</goal>
+              <goal>single</goal>
             </goals>
+            <configuration>
+              <descriptors>
+                <descriptor>assembly.xml</descriptor>
+              </descriptors>
+            </configuration>
           </execution>
         </executions>
       </plugin>

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java Wed Jul  8 13:57:13 2009
@@ -529,7 +529,7 @@
      * @return the primary path to this <code>Item</code>
      */
     Path getQPath() throws RepositoryException {
-        return state.getQPath();
+        return state.getPath();
     }
 
     /**

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrLockManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrLockManager.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrLockManager.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrLockManager.java Wed Jul  8 13:57:13 2009
@@ -93,7 +93,7 @@
      *
      * @see javax.jcr.lock.LockManager#getLockTokens()
      */
-    public String[] getLockTokens() {
+    public String[] getLockTokens() throws RepositoryException {
         return lockStateMgr.getLockTokens();
     }
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java Wed Jul  8 13:57:13 2009
@@ -20,7 +20,9 @@
 import org.slf4j.LoggerFactory;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.version.VersionManager;
+import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.spi.commons.conversion.PathResolver;
+import org.apache.jackrabbit.commons.iterator.NodeIteratorAdapter;
 
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionException;
@@ -37,6 +39,7 @@
 import javax.jcr.Node;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.lock.LockException;
+import java.util.Iterator;
 
 /**
  * <code>VersionManagerImpl</code>...
@@ -166,9 +169,19 @@
      * @see javax.jcr.version.VersionManager#merge(String, String, boolean, boolean)
      */
     public NodeIterator merge(String absPath, String srcWorkspace, boolean bestEffort, boolean isShallow) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
-        // TODO: improve
         NodeImpl n = (NodeImpl) itemManager.getNode(resolver.getQPath(absPath));
-        return n.merge(srcWorkspace, bestEffort, isShallow);
+        n.checkIsWritable();
+        session.checkHasPendingChanges();
+
+        // if same workspace, ignore
+        if (session.getWorkspace().getName().equals(srcWorkspace)) {
+            return NodeIteratorAdapter.EMPTY;
+        }
+        // make sure the workspace exists and is accessible for this session.
+        session.checkAccessibleWorkspace(srcWorkspace);
+        
+        Iterator failedIds = session.getVersionStateManager().merge((NodeState) n.getItemState(), srcWorkspace, bestEffort, isShallow);
+        return new LazyItemIterator(itemManager, session.getHierarchyManager(), failedIds);
     }
 
     /**
@@ -191,8 +204,10 @@
      * @see javax.jcr.version.VersionManager#createConfiguration(String, Version)
      */
     public Node createConfiguration(String absPath, Version baseline) throws UnsupportedRepositoryOperationException, RepositoryException {
-        // TODO
-        throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
+        // TODO: add validation
+        NodeImpl n = (NodeImpl) itemManager.getNode(resolver.getQPath(absPath));
+        NodeEntry entry = vMgr.createConfiguration((NodeState) n.getItemState(), (NodeState) ((NodeImpl) baseline).getItemState());
+        return (Node) itemManager.getItem(entry);
     }
 
     /**
@@ -215,23 +230,25 @@
      * @see javax.jcr.version.VersionManager#createActivity(String)
      */
     public Node createActivity(String title) throws UnsupportedRepositoryOperationException, RepositoryException {
-        // TODO
-        throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
+        // TODO: add validation
+        NodeEntry entry = vMgr.createActivity(title);
+        return (Node) itemManager.getItem(entry);
     }
 
     /**
-     * @see javax.jcr.version.VersionManager#removeActivity(String)
+     * @see javax.jcr.version.VersionManager#removeActivity(Node)
      */
-    public Node removeActivity(String title) throws UnsupportedRepositoryOperationException, RepositoryException {
-        // TODO
-        throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
+    public void removeActivity(Node activityNode) throws UnsupportedRepositoryOperationException, RepositoryException {
+        vMgr.removeActivity((NodeState) ((NodeImpl) activityNode).getItemState());
     }
 
     /**
      * @see javax.jcr.version.VersionManager#merge(Node)
      */
     public NodeIterator merge(Node activityNode) throws VersionException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
-        // TODO
-       throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
+        // TODO: add validation
+        Iterator failedIds = vMgr.mergeActivity((NodeState) ((NodeImpl) activityNode).getItemState());
+        return new LazyItemIterator(itemManager, session.getHierarchyManager(), failedIds);
     }
+
 }
\ No newline at end of file

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ManagerProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ManagerProvider.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ManagerProvider.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ManagerProvider.java Wed Jul  8 13:57:13 2009
@@ -23,6 +23,7 @@
 import org.apache.jackrabbit.jcr2spi.version.VersionManager;
 import org.apache.jackrabbit.jcr2spi.nodetype.ItemDefinitionProvider;
 import org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeTypeProvider;
+import org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeDefinitionProvider;
 import org.apache.jackrabbit.spi.QValueFactory;
 import org.apache.jackrabbit.spi.commons.conversion.NameResolver;
 
@@ -67,6 +68,8 @@
 
     public ItemDefinitionProvider getItemDefinitionProvider();
 
+    public NodeTypeDefinitionProvider getNodeTypeDefinitionProvider();
+
     public EffectiveNodeTypeProvider getEffectiveNodeTypeProvider();
 
     /**

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java Wed Jul  8 13:57:13 2009
@@ -66,6 +66,7 @@
 import org.apache.jackrabbit.jcr2spi.operation.ReorderNodes;
 import org.apache.jackrabbit.jcr2spi.operation.SetMixin;
 import org.apache.jackrabbit.jcr2spi.operation.Update;
+import org.apache.jackrabbit.jcr2spi.operation.SetPrimaryType;
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.jcr2spi.state.ItemStateValidator;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
@@ -93,15 +94,11 @@
 
     private static Logger log = LoggerFactory.getLogger(NodeImpl.class);
 
-    private Name primaryTypeName;
-
     protected NodeImpl(SessionImpl session, NodeState state, ItemLifeCycleListener[] listeners) {
         super(session, state, listeners);
         Name nodeTypeName = state.getNodeTypeName();
         // make sure the nodetype name is valid
-        if (session.getNodeTypeManager().hasNodeType(nodeTypeName)) {
-            primaryTypeName = nodeTypeName;
-        } else {
+        if (!session.getNodeTypeManager().hasNodeType(nodeTypeName)) {
             // should not occur. Since nodetypes are defined by the 'server'
             // its not possible to determine a fallback nodetype that is
             // always available.
@@ -154,8 +151,8 @@
      */
     public Node addNode(String relPath, String primaryNodeTypeName) throws ItemExistsException, PathNotFoundException, NoSuchNodeTypeException, LockException, VersionException, ConstraintViolationException, RepositoryException {
         checkIsWritable();
-        // 1. build qualified path and retrieve parent node
-        Path nodePath = getQPath(relPath).getNormalizedPath();
+        // build path object and retrieve parent node
+        Path nodePath = getPath(relPath).getNormalizedPath();
         if (nodePath.getNameElement().getIndex() != Path.INDEX_UNDEFINED) {
             String msg = "Illegal subscript specified: " + relPath;
             log.debug(msg);
@@ -179,11 +176,11 @@
             }
         }
 
-        // 2. get qualified names for node and nt
+        // get names objects for node and nt
         Name nodeName = nodePath.getNameElement().getName();
         Name ntName = (primaryNodeTypeName == null) ? null : getQName(primaryNodeTypeName);
 
-        // 3. create new node (including validation checks)
+        // create new node (including validation checks)
         return parentNode.createNode(nodeName, ntName);
     }
 
@@ -515,10 +512,10 @@
     }
 
     /**
-     * TODO: method name is wrong! should be getProperties (Issue 736 of the pfd)
-     * @see javax.jcr.Node#getProperty(String)
+     * @see javax.jcr.Node#getProperties(String)
      */
-    public PropertyIterator getProperty(String[] nameGlobs) throws RepositoryException {
+    public PropertyIterator getProperties(String[] nameGlobs)
+            throws RepositoryException {
         checkStatus();
         List properties = new ArrayList();
         // traverse child properties using a filtering item visitor
@@ -588,23 +585,7 @@
      * @see javax.jcr.Node#getReferences(String)
      */
     public PropertyIterator getReferences(String name) throws RepositoryException {
-        checkStatus();
-        List refs = Arrays.asList(getNodeState().getNodeReferences());
-        if (name != null) {
-            // remove property ids that don't match the given name
-            Name qName = getQName(name);
-            refs = new ArrayList(refs);
-            for (Iterator iter = refs.iterator(); iter.hasNext();) {
-                PropertyId propId = (PropertyId) iter.next();
-                if (!propId.getName().equals(qName)) {
-                    refs.remove(propId);
-                }
-            }
-        } // else: name == null -> return all references
-
-        // create an property iterator for all or the matching property ids
-        // according to the specified name.
-        return new LazyItemIterator(getItemManager(), session.getHierarchyManager(), refs.iterator());
+        return getReferences(name, false);
     }
 
     /**
@@ -618,8 +599,7 @@
      * @see javax.jcr.Node#getWeakReferences()
      */
     public PropertyIterator getWeakReferences(String name) throws RepositoryException {
-        // TODO: implementation missing
-        throw new UnsupportedRepositoryOperationException("JCR-1104");
+        return getReferences(name, true);
     }
 
     /**
@@ -641,8 +621,7 @@
     }
 
     /**
-     * Returns true, if this <code>Node</code> has a property with the given
-     * qualified name.
+     * Returns true, if this <code>Node</code> has a property with the given name.
      *
      * @param propertyName
      * @return <code>true</code>, if this <code>Node</code> has a property with
@@ -673,15 +652,36 @@
      */
     public NodeType getPrimaryNodeType() throws RepositoryException {
         checkStatus();
-        return session.getNodeTypeManager().getNodeType(primaryTypeName);
+        return session.getNodeTypeManager().getNodeType(getPrimaryNodeTypeName());
     }
 
     /**
      * @see javax.jcr.Node#setPrimaryType(String)
      */
     public void setPrimaryType(String nodeTypeName) throws RepositoryException {
-        // TODO: implementation missing
-        throw new UnsupportedRepositoryOperationException("JCR-1104");
+        checkStatus();
+
+        if (getNodeState().isRoot()) {
+            String msg = "The primary type of the root node may not be changed.";
+            log.debug(msg);
+            throw new RepositoryException(msg);
+        }
+
+        Name ntName = getQName(nodeTypeName);
+        if (ntName.equals(getPrimaryNodeTypeName())) {
+            log.debug("Changing the primary type has no effect: '" + nodeTypeName + "' already is the primary node type.");
+            return;
+        }
+
+        NodeTypeManagerImpl ntMgr = session.getNodeTypeManager();
+        NodeType nt = ntMgr.getNodeType(ntName);
+        if (nt.isMixin() || nt.isAbstract()) {
+            throw new ConstraintViolationException("Cannot change the primary type: '" + nodeTypeName + "' is a mixin type or abstract.");
+        }
+        
+        // perform the operation
+        Operation op = SetPrimaryType.create(getNodeState(), ntName);
+        session.getSessionItemStateManager().execute(op);
     }
 
     /**
@@ -703,7 +703,7 @@
     public boolean isNodeType(String nodeTypeName) throws RepositoryException {
         checkStatus();
         // try shortcut first (avoids parsing of name)
-        if (session.getNameResolver().getJCRName(primaryTypeName).equals(nodeTypeName)) {
+        if (session.getNameResolver().getJCRName(getPrimaryNodeTypeName()).equals(nodeTypeName)) {
             return true;
         }
         // parse to Name and check against effective nodetype
@@ -721,7 +721,7 @@
         // get mixin types present in the jcr:mixintypes property without
         // modifying the NodeState.
         List mixinValue = getMixinTypes();
-        if (!mixinValue.contains(mixinQName)) {
+        if (!mixinValue.contains(mixinQName) && !isNodeType(mixinQName)) {
             if (!canAddMixin(mixinQName)) {
                 throw new ConstraintViolationException("Cannot add '" + mixinName + "' mixin type.");
             }
@@ -823,7 +823,7 @@
     private EffectiveNodeType getRemainingENT(List remainingMixins)
             throws ConstraintViolationException, NoSuchNodeTypeException {
         Name[] allRemaining = (Name[]) remainingMixins.toArray(new Name[remainingMixins.size() + 1]);
-        allRemaining[remainingMixins.size()] = primaryTypeName;
+        allRemaining[remainingMixins.size()] = getPrimaryNodeTypeName();
         return session.getEffectiveNodeTypeProvider().getEffectiveNodeType(allRemaining);
     }
 
@@ -983,7 +983,7 @@
      * @see Node#merge(String, boolean)
      */
     public NodeIterator merge(String srcWorkspace, boolean bestEffort) throws NoSuchWorkspaceException, AccessDeniedException, VersionException, LockException, InvalidItemStateException, RepositoryException {
-        return merge(srcWorkspace, bestEffort, false);
+        return session.getWorkspace().getVersionManager().merge(getPath(), srcWorkspace, bestEffort);
     }
 
 
@@ -992,18 +992,7 @@
      * -> change to package protected then
      */
     public NodeIterator merge(String srcWorkspace, boolean bestEffort, boolean isShallow) throws RepositoryException {
-        checkIsWritable();
-        checkSessionHasPendingChanges();
-
-        // if same workspace, ignore
-        if (session.getWorkspace().getName().equals(srcWorkspace)) {
-            return NodeIteratorAdapter.EMPTY;
-        }
-        // make sure the workspace exists and is accessible for this session.
-        session.checkAccessibleWorkspace(srcWorkspace);
-
-        Iterator failedIds = session.getVersionStateManager().merge(getNodeState(), srcWorkspace, bestEffort, isShallow);
-        return new LazyItemIterator(getItemManager(), session.getHierarchyManager(), failedIds);
+        return session.getWorkspace().getVersionManager().merge(getPath(), srcWorkspace, bestEffort, isShallow);
     }
 
     /**
@@ -1101,7 +1090,7 @@
             getNode(relPath).restore(version, removeExisting);
         } else {
             // node at 'relPath' does not yet exist -> build the NodeId
-            Path nPath = getQPath(relPath);
+            Path nPath = getPath(relPath);
             Path parentPath = nPath.getAncestor(1);
             ItemManager itemMgr = getItemManager();
             if (itemMgr.nodeExists(parentPath)) {
@@ -1305,7 +1294,7 @@
      */
     boolean isNodeType(Name qName) throws RepositoryException {
         // first do trivial checks without using type hierarchy
-        if (qName.equals(primaryTypeName)) {
+        if (qName.equals(getPrimaryNodeTypeName())) {
             return true;
         }
         // check if contained in mixin types
@@ -1598,6 +1587,34 @@
         return qName;
     }
 
+    /**
+     * @return the primary node type name.
+     */
+    private Name getPrimaryNodeTypeName() {
+        return getNodeState().getNodeTypeName();
+    }
+
+    /**
+     * 
+     * @param name
+     * @param weak
+     * @return
+     * @throws RepositoryException
+     */
+    private LazyItemIterator getReferences(String name, boolean weak) throws RepositoryException {
+        checkStatus();
+        Name propName = (name == null) ? null : getQName(name);
+        Iterator<PropertyId> itr = getNodeState().getNodeReferences(propName, weak);
+        return new LazyItemIterator(getItemManager(), session.getHierarchyManager(), itr);
+    }
+
+    /**
+     *
+     * @param mixinName
+     * @return
+     * @throws NoSuchNodeTypeException
+     * @throws ConstraintViolationException
+     */
     private boolean canAddMixin(Name mixinName) throws NoSuchNodeTypeException,
         ConstraintViolationException {
         NodeTypeManagerImpl ntMgr = session.getNodeTypeManager();
@@ -1608,11 +1625,6 @@
             log.error(mixin.getName() + ": not a mixin node type");
             return false;
         }
-        NodeTypeImpl primaryType = ntMgr.getNodeType(primaryTypeName);
-        if (primaryType.isNodeType(mixinName)) {
-            log.debug(mixin.getName() + ": already contained in primary node type");
-            return false;
-        }
 
         // get list of existing nodetypes
         Name[] existingNts = getNodeState().getNodeTypeNames();
@@ -1621,13 +1633,7 @@
 
         // check if the base type supports adding this mixin
         if (!entExisting.supportsMixin(mixinName)) {
-            log.debug(mixin.getName() + ": not supported on node type " + primaryTypeName);
-            return false;
-        }
-
-        // check if adding new mixin conflicts with existing nodetypes
-        if (entExisting.includesNodeType(mixinName)) {
-            log.debug(mixin.getName() + ": already contained in mixin types");
+            log.debug(mixin.getName() + ": not supported on node type " + getPrimaryNodeTypeName());
             return false;
         }
 
@@ -1677,29 +1683,28 @@
     }
 
     /**
-     *
-     * @param relativePath
-     * @return
+     * @param relativeJcrPath
+     * @return Path object for the specified relative JCR path string.
      * @throws RepositoryException
      */
-    private Path getQPath(String relativePath) throws RepositoryException {
+    private Path getPath(String relativeJcrPath) throws RepositoryException {
         try {
-            Path p = session.getPathResolver().getQPath(relativePath);
-            return getQPath(p);
+            Path p = session.getPathResolver().getQPath(relativeJcrPath);
+            return getPath(p);
         } catch (NameException e) {
-            String msg = "Invalid relative path: " + relativePath;
+            String msg = "Invalid relative path: " + relativeJcrPath;
             log.debug(msg);
             throw new RepositoryException(msg, e);
         }
     }
 
     /**
-     *
      * @param relativePath
-     * @return
+     * @return normalized absolute path calculated from the given relative
+     * path and the path of this node.
      * @throws RepositoryException
      */
-    private Path getQPath(Path relativePath) throws RepositoryException {
+    private Path getPath(Path relativePath) throws RepositoryException {
         // shortcut
         if (relativePath.getLength() == 1 && relativePath.getNameElement() == session.getPathFactory().getCurrentElement()) {
             return getQPath();
@@ -1736,7 +1741,7 @@
                 }
             } else {
                 // rp length > 1
-                Path p = getQPath(rp);
+                Path p = getPath(rp);
                 targetEntry = session.getHierarchyManager().getNodeEntry(p.getCanonicalPath());
             }
         } catch (PathNotFoundException e) {
@@ -1774,7 +1779,7 @@
                 targetEntry = getNodeEntry().getPropertyEntry(propName, true);
             } else {
                 // build and resolve absolute path
-                Path p = getQPath(rp).getCanonicalPath();
+                Path p = getPath(rp).getCanonicalPath();
                 try {
                     targetEntry = session.getHierarchyManager().getPropertyEntry(p);
                 } catch (PathNotFoundException e) {

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/PropertyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/PropertyImpl.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/PropertyImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/PropertyImpl.java Wed Jul  8 13:57:13 2009
@@ -59,7 +59,8 @@
 
     public PropertyImpl(SessionImpl session, PropertyState state, ItemLifeCycleListener[] listeners) {
         super(session, state, listeners);
-        // value will be read (and converted from qualified value) on demand.
+        // NOTE: JCR value(s) will be read (and converted from the internal value
+        // representation) on demand.
     }
 
     //-----------------------------------------------------< Item interface >---
@@ -431,8 +432,8 @@
         switch (value.getType()) {
             case PropertyType.NAME:
             case PropertyType.PATH:
-                Value jcrValue = ValueFormat.getJCRValue(value, session.getNamePathResolver(), session.getJcrValueFactory());
-                length = jcrValue.getString().length();
+                String jcrString = ValueFormat.getJCRString(value, session.getNamePathResolver());
+                length = jcrString.length();
                 break;
             default:
                 length = value.getLength();
@@ -458,7 +459,15 @@
         return getPropertyState().getType();
     }
 
-    //-----------------------------------------------------------< ItemImpl >---
+    /**
+     *
+     * @return true if the definition indicates that this Property is multivalued.
+     */
+    public boolean isMultiple() {
+        return getPropertyState().isMultiValued();
+    }
+
+   //-----------------------------------------------------------< ItemImpl >---
     /**
      * Returns the Name defined with this <code>PropertyState</code>
      *
@@ -487,13 +496,6 @@
     }
 
     //---------------------------------------------< private implementation >---
-    /**
-     *
-     * @return true if the definition indicates that this Property is multivalued.
-     */
-    private boolean isMultiple() {
-        return getPropertyState().isMultiValued();
-    }
 
     /**
      *

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/RepositoryImpl.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/RepositoryImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/RepositoryImpl.java Wed Jul  8 13:57:13 2009
@@ -40,7 +40,6 @@
 import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig;
 import org.apache.jackrabbit.spi.SessionInfo;
 import org.apache.jackrabbit.spi.XASessionInfo;
-import org.apache.jackrabbit.value.ValueFactoryImpl;
 
 /**
  * <code>RepositoryImpl</code>...
@@ -55,11 +54,6 @@
     private RepositoryImpl(RepositoryConfig config) throws RepositoryException {
         this.config = config;
         descriptors = config.getRepositoryService().getRepositoryDescriptors();
-
-        // JCR-2098: Only pass through supported repository descriptors
-        // TODO: This filtering can be removed as the SPI layer is updated
-        // to support more of JCR 2.0
-        descriptors.remove(Repository.OPTION_SHAREABLE_NODES_SUPPORTED);
     }
 
     public static Repository create(RepositoryConfig config) throws RepositoryException {
@@ -88,8 +82,8 @@
     public Value getDescriptorValue(String key) {
         String value = getDescriptor(key);
         if (value != null) {
-            // TODO: Do we have a better value factory?
-            return ValueFactoryImpl.getInstance().createValue(value);
+            // TODO implementation missing
+            throw new UnsupportedOperationException("not implemented yet - see JCR-2062");
         } else {
             return null;
         }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java Wed Jul  8 13:57:13 2009
@@ -62,6 +62,7 @@
 import org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeTypeProvider;
 import org.apache.jackrabbit.jcr2spi.nodetype.ItemDefinitionProvider;
 import org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeManagerImpl;
+import org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeDefinitionProvider;
 import org.apache.jackrabbit.jcr2spi.operation.Move;
 import org.apache.jackrabbit.jcr2spi.operation.Operation;
 import org.apache.jackrabbit.jcr2spi.security.AccessManager;
@@ -148,7 +149,7 @@
         valueFactory = new ValueFactoryQImpl(config.getRepositoryService().getQValueFactory(), npResolver);
 
         // build nodetype manager
-        ntManager = new NodeTypeManagerImpl(workspace.getNodeTypeRegistry(), this, getJcrValueFactory());
+        ntManager = new NodeTypeManagerImpl(workspace.getNodeTypeRegistry(), this);
         validator = new ItemStateValidator(this, getPathFactory());
 
         itemStateManager = createSessionItemStateManager(workspace.getUpdatableItemStateManager(), workspace.getItemStateFactory());
@@ -309,7 +310,7 @@
         checkSupportedOption(Repository.LEVEL_2_SUPPORTED);
         checkIsAlive();
 
-        // retrieve qualified paths
+        // build paths from the given JCR paths.
         Path srcPath = getQPath(srcAbsPath);
         Path destPath = getQPath(destAbsPath);
 
@@ -462,7 +463,12 @@
      * @see javax.jcr.Session#getLockTokens()
      */
     public String[] getLockTokens() {
-        return getLockStateManager().getLockTokens();
+        try {
+            return getLockStateManager().getLockTokens();
+        } catch (RepositoryException e) {
+            log.warn("Unable to retrieve lock tokens for this session. (" + e.getMessage() + ")");            
+            return new String[0];
+        }
     }
 
     /**
@@ -753,6 +759,13 @@
     }
 
     /**
+     * @see ManagerProvider#getNodeTypeDefinitionProvider()
+     */
+    public NodeTypeDefinitionProvider getNodeTypeDefinitionProvider() {
+        return ntManager;
+    }
+
+    /**
      * @see ManagerProvider#getEffectiveNodeTypeProvider()
      */
     public EffectiveNodeTypeProvider getEffectiveNodeTypeProvider() {
@@ -832,12 +845,12 @@
     }
 
     /**
-     * Builds an qualified path from the given absolute path.
+     * Builds a <code>Path</code> object from the given absolute JCR path string.
      *
      * @param absPath
-     * @return
-     * @throws RepositoryException if the resulting qualified path is not absolute
-     * or if the given path cannot be resolved to a qualified path.
+     * @return A <code>Path</code> object.
+     * @throws RepositoryException if the resulting path isn't absolute
+     * or if the given JCR path cannot be resolved to a path object.
      */
     Path getQPath(String absPath) throws RepositoryException {
         try {

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java Wed Jul  8 13:57:13 2009
@@ -24,6 +24,7 @@
 import org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeTypeProvider;
 import org.apache.jackrabbit.jcr2spi.nodetype.ItemDefinitionProvider;
 import org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeRegistry;
+import org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeDefinitionProvider;
 import org.apache.jackrabbit.jcr2spi.observation.ObservationManagerImpl;
 import org.apache.jackrabbit.jcr2spi.operation.Clone;
 import org.apache.jackrabbit.jcr2spi.operation.Copy;
@@ -467,14 +468,30 @@
         return wspManager.getItemDefinitionProvider();
     }
 
+    /**
+     * @see ManagerProvider#getNodeTypeDefinitionProvider()
+     */
+    public NodeTypeDefinitionProvider getNodeTypeDefinitionProvider() {
+        return session.getNodeTypeManager();
+    }
+
+    /**
+     * @see ManagerProvider#getEffectiveNodeTypeProvider()
+     */
     public EffectiveNodeTypeProvider getEffectiveNodeTypeProvider() {
         return wspManager.getEffectiveNodeTypeProvider();
     }
 
+    /**
+     * @see ManagerProvider#getJcrValueFactory()
+     */
     public ValueFactory getJcrValueFactory() throws RepositoryException {
         return session.getJcrValueFactory();
     }
 
+    /**
+     * @see ManagerProvider#getQValueFactory()
+     */
     public QValueFactory getQValueFactory() throws RepositoryException {
         return session.getQValueFactory();
     }
@@ -565,8 +582,9 @@
      * Create the <code>ObservationManager</code>. May be overridden by subclasses.
      *
      * @return a new <code>ObservationManager</code> instance
+     * @throws RepositoryException
      */
-    protected ObservationManager createObservationManager(NamePathResolver resolver, NodeTypeRegistry ntRegistry) {
+    protected ObservationManager createObservationManager(NamePathResolver resolver, NodeTypeRegistry ntRegistry) throws RepositoryException {
         return new ObservationManagerImpl(wspManager, resolver, ntRegistry);
     }
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java Wed Jul  8 13:57:13 2009
@@ -57,6 +57,10 @@
 import org.apache.jackrabbit.jcr2spi.operation.RemoveVersion;
 import org.apache.jackrabbit.jcr2spi.operation.WorkspaceImport;
 import org.apache.jackrabbit.jcr2spi.operation.Checkpoint;
+import org.apache.jackrabbit.jcr2spi.operation.CreateActivity;
+import org.apache.jackrabbit.jcr2spi.operation.CreateConfiguration;
+import org.apache.jackrabbit.jcr2spi.operation.RemoveActivity;
+import org.apache.jackrabbit.jcr2spi.operation.SetPrimaryType;
 import org.apache.jackrabbit.jcr2spi.security.AccessManager;
 import org.apache.jackrabbit.jcr2spi.observation.InternalEventListener;
 import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
@@ -96,7 +100,6 @@
 import javax.jcr.ItemExistsException;
 import javax.jcr.InvalidItemStateException;
 import javax.jcr.MergeException;
-import javax.jcr.Session;
 import javax.jcr.ReferentialIntegrityException;
 import javax.jcr.query.InvalidQueryException;
 import javax.jcr.version.VersionException;
@@ -207,15 +210,15 @@
         return service.getWorkspaceNames(sessionInfo);
     }
 
-    public IdFactory getIdFactory() throws RepositoryException {
+    public IdFactory getIdFactory() {
         return idFactory;
     }
 
-    public NameFactory getNameFactory() throws RepositoryException {
+    public NameFactory getNameFactory() {
         return nameFactory;
     }
 
-    public PathFactory getPathFactory() throws RepositoryException {
+    public PathFactory getPathFactory()  {
         return pathFactory;
     }
 
@@ -227,44 +230,42 @@
         return service.getLockInfo(sessionInfo, nodeId);
     }
 
-    public String[] getLockTokens() {
+    /**
+     * Returns the lock tokens present with the <code>SessionInfo</code>.
+     *
+     * @return lock tokens present with the <code>SessionInfo</code>.
+     * @throws UnsupportedRepositoryOperationException
+     * @throws RepositoryException
+     * @see org.apache.jackrabbit.spi.SessionInfo#getLockTokens() 
+     */
+    public String[] getLockTokens() throws UnsupportedRepositoryOperationException, RepositoryException {
         return sessionInfo.getLockTokens();
     }
 
     /**
-     * This method always succeeds.
-     * This is not compliant to the requirements for {@link Session#addLockToken(String)}
-     * as defined by JSR170, which defines that at most one single <code>Session</code>
-     * may contain the same lock token. However, with SPI it is not possible
-     * to determine, whether another session holds the lock, nor can the client
-     * determine, which lock this token belongs to. The latter would be
-     * necessary in order to build the 'Lock' object properly.
+     * This method succeeds if the lock tokens could be added to the
+     * <code>SessionInfo</code>.
      *
      * @param lt
+     * @throws UnsupportedRepositoryOperationException
      * @throws LockException
      * @throws RepositoryException
+     * @see SessionInfo#addLockToken(String)
      */
-    public void addLockToken(String lt) throws LockException, RepositoryException {
+    public void addLockToken(String lt) throws UnsupportedRepositoryOperationException, LockException, RepositoryException {
         sessionInfo.addLockToken(lt);
-        /*
-        // TODO: JSR170 defines that a token can be present with one session only.
-        //       however, we cannot find out about another session holding the lock.
-        //       and neither knows the server, which session is holding a lock token.
-        */
     }
 
     /**
-     * Tries to remove the given token from the <code>SessionInfo</code>. If the
-     * SessionInfo does not contains the specified token, this method returns
-     * silently.<br>
-     * Note, that any restriction regarding removal of lock tokens must be asserted
-     * before this method is called.
+     * Tries to remove the given token from the <code>SessionInfo</code>.
      *
      * @param lt
+     * @throws UnsupportedRepositoryOperationException
      * @throws LockException
      * @throws RepositoryException
+     * @see SessionInfo#removeLockToken(String)
      */
-    public void removeLockToken(String lt) throws LockException, RepositoryException {
+    public void removeLockToken(String lt) throws UnsupportedRepositoryOperationException, LockException, RepositoryException {
         String[] tokems = sessionInfo.getLockTokens();
         for (int i = 0; i < tokems.length; i++) {
             if (tokems[i].equals(lt)) {
@@ -274,7 +275,7 @@
         }
         // sessionInfo doesn't contain the given lock token and is therefore
         // not the lock holder
-        throw new RepositoryException("Unable to remove locktoken '" + lt + "' from Session.");
+        throw new LockException("Unable to remove locktoken '" + lt + "' from Session.");
     }
 
     /**
@@ -293,15 +294,16 @@
      * @param language   the query language.
      * @param namespaces the locally remapped namespaces which might be used in
      *                   the query statement.
+     * @return the bind variable names.
      * @throws InvalidQueryException if the query statement is invalid.
      * @throws RepositoryException   if an error occurs while checking the query
      *                               statement.
      */
-    public void checkQueryStatement(String statement,
-                                    String language,
-                                    Map namespaces)
+    public String[] checkQueryStatement(String statement,
+                                        String language,
+                                        Map namespaces)
             throws InvalidQueryException, RepositoryException {
-        service.checkQueryStatement(sessionInfo, statement, language, namespaces);
+        return service.checkQueryStatement(sessionInfo, statement, language, namespaces);
     }
 
     /**
@@ -309,12 +311,15 @@
      * @param language   the query language.
      * @param namespaces the locally remapped namespaces which might be used in
      *                   the query statement.
+     * @param limit
+     * @param offset
+     * @param boundValues
      * @return
      * @throws RepositoryException
      */
-    public QueryInfo executeQuery(String statement, String language, Map namespaces)
-            throws RepositoryException {
-        return service.executeQuery(sessionInfo, statement, language, namespaces);
+    public QueryInfo executeQuery(String statement, String language, Map namespaces,
+                                  long limit, long offset, Map<String, QValue> boundValues) throws RepositoryException {
+        return service.executeQuery(sessionInfo, statement, language, namespaces, limit, offset, boundValues);
     }
 
     /**
@@ -389,6 +394,30 @@
         return service.createEventFilter(sessionInfo, eventTypes, path, isDeep, uuids, nodeTypes, noLocal);
     }
 
+    /**
+     * Returns the events from the journal that occurred after a given date.
+     *
+     * @param filter the event filter to apply.
+     * @param after  a date in milliseconds.
+     * @return the events as a bundle.
+     * @throws RepositoryException if an error occurs.
+     * @throws UnsupportedRepositoryOperationException
+     *                             if the implementation does not support
+     *                             journaled observation.
+     */
+    public EventBundle getEvents(EventFilter filter, long after)
+            throws RepositoryException, UnsupportedRepositoryOperationException {
+        return service.getEvents(sessionInfo, filter, after);
+    }
+
+    /**
+     *
+     * @param userData
+     * @throws RepositoryException
+     */
+    public void setUserData(String userData) throws RepositoryException {
+        sessionInfo.setUserData(userData);
+    }
     //--------------------------------------------------------------------------
 
     /**
@@ -713,6 +742,12 @@
                         case Event.PROPERTY_REMOVED:
                             type = "PropertyRemoved";
                             break;
+                        case Event.NODE_MOVED:
+                            type = "NodeMoved";
+                            break;
+                        case Event.PERSIST:
+                            type = "Persist";
+                            break;
                         default:
                             type = "Unknown";
                     }
@@ -886,6 +921,14 @@
 
         /**
          * @inheritDoc
+         * @see OperationVisitor#visit(SetPrimaryType)
+         */
+        public void visit(SetPrimaryType operation) throws RepositoryException {
+            batch.setPrimaryType(operation.getNodeId(), operation.getPrimaryTypeName());
+        }
+
+        /**
+         * @inheritDoc
          * @see OperationVisitor#visit(SetPropertyValue)
          */
         public void visit(SetPropertyValue operation) throws RepositoryException {
@@ -961,7 +1004,12 @@
          */
         public void visit(Merge operation) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
             NodeId nId = operation.getNodeId();
-            Iterator failed = service.merge(sessionInfo, nId, operation.getSourceWorkspaceName(), operation.bestEffort(), operation.isShallow());
+            Iterator failed;
+            if (operation.isActivityMerge()) {
+                failed = service.mergeActivity(sessionInfo, nId);
+            } else {
+                failed = service.merge(sessionInfo, nId, operation.getSourceWorkspaceName(), operation.bestEffort(), operation.isShallow());
+            }
             operation.setFailedIds(failed);
         }
 
@@ -1038,6 +1086,29 @@
         public void visit(WorkspaceImport operation) throws RepositoryException {
             service.importXml(sessionInfo, operation.getNodeId(), operation.getXmlStream(), operation.getUuidBehaviour());
         }
+
+        /**
+         * @see OperationVisitor#visit(CreateActivity)
+         */
+        public void visit(CreateActivity operation) throws RepositoryException {
+            NodeId activityId = service.createActivity(sessionInfo, operation.getTitle());
+            operation.setNewActivityId(activityId);
+        }
+
+        /**
+         * @see OperationVisitor#visit(RemoveActivity)
+         */
+        public void visit(RemoveActivity operation) throws RepositoryException {
+            service.removeActivity(sessionInfo, (NodeId) operation.getRemoveId());
+        }
+
+        /**
+         * @see OperationVisitor#visit(CreateConfiguration)
+         */
+        public void visit(CreateConfiguration operation) throws RepositoryException {
+            NodeId configId = service.createConfiguration(sessionInfo, operation.getNodeId(), operation.getBaselineId());
+            operation.setNewConfigurationId(configId);
+        }
     }
 
     //------------------------------------------------------< ChangePolling >---

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java Wed Jul  8 13:57:13 2009
@@ -767,13 +767,13 @@
         /**
          * Returns a unmodifiable List of NodeEntry objects even if the name map
          * only contains a single entry for the given name. If no matching entry
-         * exists for the given qualified name an empty list is returned.
+         * exists for the given <code>Name</code> an empty list is returned.
          *
-         * @param qName
+         * @param name
          * @return list of entries or an empty list.
          */
-        public List getList(Name qName) {
-            Object obj = get(qName);
+        public List getList(Name name) {
+            Object obj = get(name);
             if (obj == null) {
                 return Collections.EMPTY_LIST;
             } else if (obj instanceof List) {
@@ -785,8 +785,8 @@
             }
         }
 
-        public NodeEntry getNodeEntry(Name qName, int index) {
-            Object obj = get(qName);
+        public NodeEntry getNodeEntry(Name name, int index) {
+            Object obj = get(name);
             if (obj == null) {
                 return null;
             }
@@ -802,35 +802,35 @@
             return null;
         }
 
-        public LinkedEntries.LinkNode getLinkNode(Name qName, int index) {
+        public LinkedEntries.LinkNode getLinkNode(Name name, int index) {
             if (index < Path.INDEX_DEFAULT) {
                 throw new IllegalArgumentException("Illegal index " + index);
             }
 
-            LinkedEntries.LinkNode val = (LinkedEntries.LinkNode) nameMap.get(qName);
+            LinkedEntries.LinkNode val = (LinkedEntries.LinkNode) nameMap.get(name);
             if (val != null) {
                 return (index == Path.INDEX_DEFAULT) ? val : null;
             } else {
                 // look in snsMap
-                List l = (List) snsMap.get(qName);
+                List l = (List) snsMap.get(name);
                 int pos = index - 1; // Index of NodeEntry is 1-based
                 return (l != null && pos < l.size()) ? (LinkedEntries.LinkNode) l.get(pos) : null;
             }
         }
 
-        public LinkedEntries.LinkNode getLinkNode(Name qName, int index, String uniqueID) {
+        public LinkedEntries.LinkNode getLinkNode(Name name, int index, String uniqueID) {
             if (uniqueID != null) {
                 // -> try if any entry matches.
                 // if none matches it be might that entry doesn't have uniqueID
                 // set yet -> search without uniqueID
-                LinkedEntries.LinkNode val = (LinkedEntries.LinkNode) nameMap.get(qName);
+                LinkedEntries.LinkNode val = (LinkedEntries.LinkNode) nameMap.get(name);
                 if (val != null) {
                     if (uniqueID.equals(val.getNodeEntry().getUniqueID())) {
                         return val;
                     }
                 } else {
                     // look in snsMap
-                    List l = (List) snsMap.get(qName);
+                    List l = (List) snsMap.get(name);
                     if (l != null) {
                         for (Iterator it = l.iterator(); it.hasNext();) {
                             LinkedEntries.LinkNode ln = (LinkedEntries.LinkNode) it.next();
@@ -843,25 +843,25 @@
             }
             // no uniqueID passed or not match.
             // try to load the child entry by name and index.
-            return getLinkNode(qName, index);
+            return getLinkNode(name, index);
         }
 
-        public void put(Name qName, int index, LinkedEntries.LinkNode value) {
+        public void put(Name name, int index, LinkedEntries.LinkNode value) {
             // if 'nameMap' already contains a single entry -> move it to snsMap
-            LinkedEntries.LinkNode single = (LinkedEntries.LinkNode) nameMap.remove(qName);
+            LinkedEntries.LinkNode single = (LinkedEntries.LinkNode) nameMap.remove(name);
             List l;
             if (single != null) {
                 l = new ArrayList();
                 l.add(single);
-                snsMap.put(qName, l);
+                snsMap.put(name, l);
             } else {
                 // if 'snsMap' already contains list
-                l = (List) snsMap.get(qName);
+                l = (List) snsMap.get(name);
             }
 
             if (l == null) {
                 // no same name siblings -> simply put to the name map.
-                nameMap.put(qName, value);
+                nameMap.put(name, value);
             } else {
                 // sibling(s) already present -> insert into the list
                 int position = index - 1;
@@ -873,10 +873,10 @@
             }
         }
 
-        public LinkedEntries.LinkNode remove(Name qName, LinkedEntries.LinkNode value) {
-            Object rm = nameMap.remove(qName);
+        public LinkedEntries.LinkNode remove(Name name, LinkedEntries.LinkNode value) {
+            Object rm = nameMap.remove(name);
             if (rm == null) {
-                List l = (List) snsMap.get(qName);
+                List l = (List) snsMap.get(name);
                 if (l != null && l.remove(value)) {
                     rm = value;
                 }
@@ -884,8 +884,8 @@
             return ((LinkedEntries.LinkNode) rm);
         }
 
-        public void reorder(Name qName, LinkedEntries.LinkNode insertValue, int position) {
-            List sns = (List) snsMap.get(qName);
+        public void reorder(Name name, LinkedEntries.LinkNode insertValue, int position) {
+            List sns = (List) snsMap.get(name);
             if (sns == null) {
                 // no same name siblings -> no special handling required
                 return;

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEventListener.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEventListener.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEventListener.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEventListener.java Wed Jul  8 13:57:13 2009
@@ -26,6 +26,7 @@
 import org.apache.jackrabbit.spi.EventBundle;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.ItemId;
 
 import javax.jcr.RepositoryException;
 import java.util.Collection;
@@ -44,7 +45,7 @@
     private static Logger log = LoggerFactory.getLogger(HierarchyEventListener.class);
 
     private final HierarchyManager hierarchyMgr;
-    private final Collection eventFilter;
+    private final Collection<EventFilter> eventFilter;
 
     public HierarchyEventListener(WorkspaceManager wspManager,
                                   HierarchyManager hierarchyMgr,
@@ -59,14 +60,18 @@
             } catch (RepositoryException e) {
                 // spi does not support observation, or another error occurred.
             }
-            this.eventFilter = (filter == null) ? Collections.EMPTY_LIST : Collections.singletonList(filter);
+            if (filter == null) {
+                this.eventFilter = Collections.emptyList();
+            } else {
+                this.eventFilter = Collections.singletonList(filter);
+            }
             try {
                 wspManager.addEventListener(this);
             } catch (RepositoryException e) {
                 // spi does not support observation, or another error occurred.
             }
         } else {
-            this.eventFilter = Collections.EMPTY_LIST;
+            this.eventFilter = Collections.emptyList();
         }
     }
 
@@ -74,7 +79,7 @@
     /**
      * @see InternalEventListener#getEventFilters()
      */
-    public Collection getEventFilters() {
+    public Collection<EventFilter> getEventFilters() {
         return eventFilter;
     }
 
@@ -84,7 +89,7 @@
      * since workspace operations are reported as local changes as well and
      * might have invoked changes (autocreated items etc.).
      *
-     * @param eventBundle
+     * @param eventBundle the events.
      * @see InternalEventListener#onEvent(EventBundle)
      */
     public void onEvent(EventBundle eventBundle) {
@@ -99,17 +104,20 @@
      * Retrieve the workspace state(s) affected by the given event and refresh
      * them accordingly.
      *
-     * @param events
+     * @param events the events to process.
      */
-    private void pushEvents(Collection events) {
+    private void pushEvents(Collection<Event> events) {
         if (events.isEmpty()) {
             log.debug("Empty event bundle");
             return;
         }
+
+        // TODO: handle new 283 event types and clean add/remove that is also present as move-event.
+
         // collect set of removed node ids
-        Set removedEvents = new HashSet();
+        Set<ItemId> removedEvents = new HashSet<ItemId>();
         // separately collect the add events
-        Set addEvents = new HashSet();
+        Set<Event> addEvents = new HashSet<Event>();
 
         for (Iterator it = events.iterator(); it.hasNext();) {
             Event event = (Event) it.next();
@@ -167,38 +175,49 @@
         }
 
         /* process all other events (removal, property changed) */
-        for (Iterator it = events.iterator(); it.hasNext(); ) {
-            Event event = (Event) it.next();
+        for (Event event : events) {
             int type = event.getType();
 
             NodeId parentId = event.getParentId();
             NodeEntry parent = (parentId != null) ? (NodeEntry) hierarchyMgr.lookup(parentId) : null;
-            if (type == Event.NODE_REMOVED || type == Event.PROPERTY_REMOVED) {
-                // notify parent about removal if its child-entry.
-                // - if parent is 'null' (i.e. not yet loaded) the child-entry does
-                //   not exist either -> no need to inform child-entry
-                // - if parent got removed with the same event-bundle
-                //   only remove the parent an skip this event.
-                if (parent != null && !removedEvents.contains(parentId)) {
-                    parent.refresh(event);
-                }
-            } else if (type == Event.PROPERTY_CHANGED) {
-                // notify parent in case jcr:mixintypes or jcr:uuid was changed.
-                // if parent is 'null' (i.e. not yet loaded) the prop-entry does
-                // not exist either -> no need to inform propEntry
-                if (parent != null) {
-                    parent.refresh(event);
-                }
-            } else {
-                // should never occur
-                throw new IllegalArgumentException("Invalid event type: " + event.getType());
+            switch (type) {
+                case Event.NODE_REMOVED:
+                case Event.PROPERTY_REMOVED:
+                    // notify parent about removal if its child-entry.
+                    // - if parent is 'null' (i.e. not yet loaded) the child-entry does
+                    //   not exist either -> no need to inform child-entry
+                    // - if parent got removed with the same event-bundle
+                    //   only remove the parent an skip this event.
+                    if (parent != null && !removedEvents.contains(parentId)) {
+                        parent.refresh(event);
+                    }
+                    break;
+                case Event.PROPERTY_CHANGED:
+                    // notify parent in case jcr:mixintypes or jcr:uuid was changed.
+                    // if parent is 'null' (i.e. not yet loaded) the prop-entry does
+                    // not exist either -> no need to inform propEntry
+                    if (parent != null) {
+                        parent.refresh(event);
+                    }
+                    break;
+                case Event.NODE_MOVED:
+                    // TODO: implementation missing
+                    throw new UnsupportedOperationException("Implementation missing");
+                    //break;
+                case Event.PERSIST:
+                    // TODO: implementation missing
+                    throw new UnsupportedOperationException("Implementation missing");
+                    //break;
+                default:
+                    // should never occur
+                    throw new IllegalArgumentException("Invalid event type: " + event.getType());
             }
         }
     }
 
-    private static Collection getEventCollection(EventBundle eventBundle) {
-        List evs = new ArrayList();
-        for (Iterator it = eventBundle.getEvents(); it.hasNext();) {
+    private static Collection<Event> getEventCollection(EventBundle eventBundle) {
+        List<Event> evs = new ArrayList<Event>();
+        for (Iterator<Event> it = eventBundle.getEvents(); it.hasNext();) {
            evs.add(it.next());
         }
         return evs;



Mime
View raw message