jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1412066 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: SessionDelegate.java SessionImpl.java WorkspaceImpl.java
Date Wed, 21 Nov 2012 11:40:21 GMT
Author: angela
Date: Wed Nov 21 11:40:20 2012
New Revision: 1412066

URL: http://svn.apache.org/viewvc?rev=1412066&view=rev
Log:
OAK-250 : Enforce jcr constraints for 'protected' items

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java?rev=1412066&r1=1412065&r2=1412066&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
Wed Nov 21 11:40:20 2012
@@ -532,4 +532,11 @@ public class SessionDelegate {
     DefinitionProvider getDefinitionProvider() throws RepositoryException {
         return (DefinitionProvider) workspace.getNodeTypeManager();
     }
+
+    void checkProtectedNodes(String... absJcrPaths) throws RepositoryException {
+        for (String absPath : absJcrPaths) {
+            NodeImpl node = (NodeImpl) session.getNode(absPath);
+            node.checkProtected();
+        }
+    }
 }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java?rev=1412066&r1=1412065&r2=1412066&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
Wed Nov 21 11:40:20 2012
@@ -54,6 +54,7 @@ import org.apache.jackrabbit.oak.commons
 import org.apache.jackrabbit.oak.jcr.xml.XmlImportHandler;
 import org.apache.jackrabbit.oak.spi.security.authentication.ImpersonationCredentials;
 import org.apache.jackrabbit.oak.util.TODO;
+import org.apache.jackrabbit.util.Text;
 import org.apache.jackrabbit.util.XMLChar;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -254,7 +255,8 @@ public class SessionImpl extends Abstrac
     public void move(final String srcAbsPath, final String destAbsPath) throws RepositoryException
{
         ensureIsAlive();
 
-        // FIXME: check for protection on src-parent and dest-parent (OAK-250)
+        dlg.checkProtectedNodes(Text.getRelativeParent(srcAbsPath, 1), Text.getRelativeParent(destAbsPath,
1));
+
         dlg.perform(new SessionOperation<Void>() {
             @Override
             public Void perform() throws RepositoryException {

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java?rev=1412066&r1=1412065&r2=1412066&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
Wed Nov 21 11:40:20 2012
@@ -43,6 +43,7 @@ import org.apache.jackrabbit.oak.jcr.ver
 import org.apache.jackrabbit.oak.namepath.NameMapper;
 import org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistry;
 import org.apache.jackrabbit.oak.plugins.nodetype.ReadWriteNodeTypeManager;
+import org.apache.jackrabbit.util.Text;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.ContentHandler;
@@ -65,8 +66,7 @@ public class WorkspaceImpl implements Ja
 
     private final LockManager lockManager;
 
-    public WorkspaceImpl(SessionDelegate sessionDelegate)
-            throws RepositoryException {
+    public WorkspaceImpl(SessionDelegate sessionDelegate) {
         this.sessionDelegate = sessionDelegate;
         this.queryManager = new QueryManagerImpl(sessionDelegate);
         this.lockManager = new LockManagerImpl(sessionDelegate.getSession());
@@ -96,7 +96,7 @@ public class WorkspaceImpl implements Ja
             throw new UnsupportedRepositoryOperationException("Not implemented.");
         }
 
-        // FIXME: check for protection on src-parent and dest-parent (OAK-250)
+        sessionDelegate.checkProtectedNodes(Text.getRelativeParent(srcAbsPath, 1), Text.getRelativeParent(destAbsPath,
1));
 
         String oakPath = sessionDelegate.getOakPathKeepIndexOrThrowNotFound(destAbsPath);
         String oakName = PathUtils.getName(oakPath);
@@ -114,9 +114,9 @@ public class WorkspaceImpl implements Ja
     public void clone(String srcWorkspace, String srcAbsPath, String destAbsPath, boolean
removeExisting) throws RepositoryException {
         ensureIsAlive();
 
-        // TODO
-        // FIXME: check for protection on src-parent and dest-parent (OAK-250)
+        sessionDelegate.checkProtectedNodes(Text.getRelativeParent(srcAbsPath, 1), Text.getRelativeParent(destAbsPath,
1));
 
+        // TODO
         throw new UnsupportedRepositoryOperationException("Not implemented.");
     }
 
@@ -124,7 +124,7 @@ public class WorkspaceImpl implements Ja
     public void move(String srcAbsPath, String destAbsPath) throws RepositoryException {
         ensureIsAlive();
 
-        // FIXME: check for protection on src-parent and dest-parent (OAK-250)
+        sessionDelegate.checkProtectedNodes(Text.getRelativeParent(srcAbsPath, 1), Text.getRelativeParent(destAbsPath,
1));
 
         String oakPath = sessionDelegate.getOakPathKeepIndexOrThrowNotFound(destAbsPath);
         String oakName = PathUtils.getName(oakPath);



Mime
View raw message