You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by md...@apache.org on 2013/03/26 18:01:03 UTC

svn commit: r1461230 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: ItemImpl.java NodeImpl.java PropertyImpl.java WorkspaceImpl.java

Author: mduerig
Date: Tue Mar 26 17:01:03 2013
New Revision: 1461230

URL: http://svn.apache.org/r1461230
Log:
OAK-672: Avoid JCR APIs calling other JCR APIs
OAK-662: Reduce boilerplate code in JCR impl methods
 - move common utility methods to ItemImpl
 - wrap implementation into ItemOperation where necessary. Except for PropertyImpl.setValue(s) methods, which I'll handle separately

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.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/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java?rev=1461230&r1=1461229&r2=1461230&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemImpl.java Tue Mar 26 17:01:03 2013
@@ -19,16 +19,17 @@ package org.apache.jackrabbit.oak.jcr;
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 import javax.jcr.AccessDeniedException;
-import javax.jcr.InvalidItemStateException;
 import javax.jcr.Item;
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.ValueFactory;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.ItemDefinition;
 import javax.jcr.nodetype.NodeTypeManager;
+import javax.jcr.version.VersionManager;
 
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.jcr.delegate.ItemDelegate;
@@ -36,6 +37,7 @@ import org.apache.jackrabbit.oak.jcr.del
 import org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate;
 import org.apache.jackrabbit.oak.jcr.delegate.SessionOperation;
 import org.apache.jackrabbit.oak.plugins.nodetype.DefinitionProvider;
+import org.apache.jackrabbit.oak.plugins.nodetype.EffectiveNodeTypeProvider;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -78,7 +80,7 @@ abstract class ItemImpl<T extends ItemDe
      * @throws RepositoryException as thrown by {@code op.perform()}.
      */
     @CheckForNull
-    protected <T> T perform(@Nonnull SessionOperation<T> op) throws RepositoryException {
+    protected final <T> T perform(@Nonnull SessionOperation<T> op) throws RepositoryException {
         return sessionDelegate.perform(op);
     }
 
@@ -91,7 +93,7 @@ abstract class ItemImpl<T extends ItemDe
      * @return  the result of {@code op.perform()}
      */
     @CheckForNull
-    protected <T> T safePerform(@Nonnull SessionOperation<T> op) {
+    protected final <T> T safePerform(@Nonnull SessionOperation<T> op) {
         try {
             return sessionDelegate.perform(op);
         }
@@ -254,6 +256,7 @@ abstract class ItemImpl<T extends ItemDe
      * Performs a sanity check on this item and the associated session.
      *
      * @throws RepositoryException if this item has been rendered invalid for some reason
+     * or the associated session has been logged out.
      */
     void checkStatus() throws RepositoryException {
         sessionDelegate.checkAlive();
@@ -274,26 +277,30 @@ abstract class ItemImpl<T extends ItemDe
         checkProtected(definition);
     }
 
-    void checkProtected(ItemDefinition definition) throws RepositoryException {
+    void checkProtected(ItemDefinition definition) throws ConstraintViolationException {
         if (definition.isProtected()) {
             throw new ConstraintViolationException("Item is protected.");
         }
     }
 
-    /**
-     * Ensure that the associated session has no pending changes and throw an
-     * exception otherwise.
-     *
-     * @throws InvalidItemStateException if this nodes session has pending changes
-     * @throws RepositoryException
-     */
-    void ensureNoPendingSessionChanges() throws RepositoryException {
-        // check for pending changes
-        if (sessionDelegate.hasPendingChanges()) {
-            String msg = "Unable to perform operation. Session has pending changes.";
-            log.debug(msg);
-            throw new InvalidItemStateException(msg);
-        }
+    @Nonnull
+    String getOakName(String name) throws RepositoryException {
+        return sessionContext.getOakName(name);
+    }
+
+    @Nonnull
+    String getOakPathOrThrow(String jcrPath) throws RepositoryException {
+        return sessionContext.getOakPathOrThrow(jcrPath);
+    }
+
+    @Nonnull
+    String getOakPathOrThrowNotFound(String relPath) throws PathNotFoundException {
+        return sessionContext.getOakPathOrThrowNotFound(relPath);
+    }
+
+    @Nonnull
+    String toJcrPath(String oakPath) {
+        return sessionContext.getJcrPath(oakPath);
     }
 
     /**
@@ -317,7 +324,13 @@ abstract class ItemImpl<T extends ItemDe
     }
 
     @Nonnull
-    String toJcrPath(String oakPath) {
-        return sessionContext.getJcrPath(oakPath);
+    EffectiveNodeTypeProvider getEffectiveNodeTypeProvider() {
+        return sessionContext.getEffectiveNodeTypeProvider();
     }
+
+    @Nonnull
+    VersionManager getVersionManager() throws RepositoryException {
+        return sessionContext.getVersionManager();
+    }
+
 }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java?rev=1461230&r1=1461229&r2=1461230&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java Tue Mar 26 17:01:03 2013
@@ -61,7 +61,6 @@ import javax.jcr.nodetype.PropertyDefini
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionException;
 import javax.jcr.version.VersionHistory;
-import javax.jcr.version.VersionManager;
 
 import com.google.common.base.Function;
 import com.google.common.base.Predicate;
@@ -86,7 +85,6 @@ import org.apache.jackrabbit.oak.jcr.del
 import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.plugins.nodetype.DefinitionProvider;
 import org.apache.jackrabbit.oak.plugins.nodetype.EffectiveNodeType;
-import org.apache.jackrabbit.oak.plugins.nodetype.EffectiveNodeTypeProvider;
 import org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants;
 import org.apache.jackrabbit.oak.plugins.value.ValueFactoryImpl;
 import org.apache.jackrabbit.oak.util.TODO;
@@ -206,10 +204,6 @@ public class NodeImpl<T extends NodeDele
         return addNode(relPath, null);
     }
 
-    private String getOakPath(String jcrPath) throws RepositoryException {
-        return sessionContext.getOakPathOrThrow(jcrPath);
-    }
-
     @Override
     @Nonnull
     public Node addNode(final String relPath, final String primaryNodeTypeName) throws RepositoryException {
@@ -218,7 +212,7 @@ public class NodeImpl<T extends NodeDele
             public Node perform() throws RepositoryException {
                 String oakPath = sessionContext.getOakPathKeepIndexOrThrowNotFound(relPath);
                 String oakName = PathUtils.getName(oakPath);
-                String parentPath = getOakPath(PathUtils.getParentPath(oakPath));
+                String parentPath = getOakPathOrThrow(PathUtils.getParentPath(oakPath));
 
                 // handle index
                 if (oakName.contains("[")) {
@@ -280,23 +274,16 @@ public class NodeImpl<T extends NodeDele
         });
     }
 
-    @Nonnull
-    private String getOakName(String name) throws RepositoryException {
-        return sessionContext.getOakName(name);
-    }
-
     @Override
     public void orderBefore(final String srcChildRelPath, final String destChildRelPath) throws RepositoryException {
         perform(new ItemWriteOperation<Void>() {
             @Override
             public Void perform() throws RepositoryException {
                 getEffectiveNodeType().checkOrderableChildNodes();
-                String oakSrcChildRelPath =
-                        getOakPathOrThrowNotFound(srcChildRelPath);
+                String oakSrcChildRelPath = getOakPathOrThrowNotFound(srcChildRelPath);
                 String oakDestChildRelPath = null;
                 if (destChildRelPath != null) {
-                    oakDestChildRelPath =
-                            getOakPathOrThrowNotFound(destChildRelPath);
+                    oakDestChildRelPath = getOakPathOrThrowNotFound(destChildRelPath);
                 }
                 dlg.orderBefore(oakSrcChildRelPath, oakDestChildRelPath);
                 return null;
@@ -304,10 +291,6 @@ public class NodeImpl<T extends NodeDele
         });
     }
 
-    private String getOakPathOrThrowNotFound(String relPath) throws PathNotFoundException {
-        return sessionContext.getOakPathOrThrowNotFound(relPath);
-    }
-
     //-------------------------------------------------------< setProperty >--
     //
     // The setProperty() variants below follow the same pattern:
@@ -732,13 +715,36 @@ public class NodeImpl<T extends NodeDele
         return 1;
     }
 
+    private PropertyIterator internalGetReferences(final String name, final boolean weak) throws RepositoryException {
+        return perform(new ItemReadOperation<PropertyIterator>() {
+            @Override
+            public PropertyIterator perform() throws InvalidItemStateException {
+                IdentifierManager idManager = sessionDelegate.getIdManager();
+
+                Set<String> propertyOakPaths = idManager.getReferences(weak, dlg.getTree(), name);
+                Iterable<Property> properties = Iterables.transform(
+                        propertyOakPaths,
+                        new Function<String, Property>() {
+                            @Override
+                            public Property apply(String oakPath) {
+                                PropertyDelegate pd = sessionDelegate.getProperty(oakPath);
+                                return pd == null ? null : new PropertyImpl(pd, sessionContext);
+                            }
+                        }
+                );
+
+                return new PropertyIteratorAdapter(properties.iterator(), propertyOakPaths.size());
+            }
+        });
+    }
+
     /**
      * @see javax.jcr.Node#getReferences()
      */
     @Override
     @Nonnull
     public PropertyIterator getReferences() throws RepositoryException {
-        return getReferences(null);
+        return internalGetReferences(null, false);
     }
 
     @Override
@@ -753,7 +759,7 @@ public class NodeImpl<T extends NodeDele
     @Override
     @Nonnull
     public PropertyIterator getWeakReferences() throws RepositoryException {
-        return getWeakReferences(null);
+        return internalGetReferences(null, true);
     }
 
     @Override
@@ -762,35 +768,12 @@ public class NodeImpl<T extends NodeDele
         return internalGetReferences(name, true);
     }
 
-    private PropertyIterator internalGetReferences(final String name, final boolean weak) throws RepositoryException {
-        return perform(new ItemReadOperation<PropertyIterator>() {
-            @Override
-            public PropertyIterator perform() throws InvalidItemStateException {
-                IdentifierManager idManager = sessionDelegate.getIdManager();
-
-                Set<String> propertyOakPaths = idManager.getReferences(weak, dlg.getTree(), name);
-                Iterable<Property> properties = Iterables.transform(
-                        propertyOakPaths,
-                        new Function<String, Property>() {
-                            @Override
-                            public Property apply(String oakPath) {
-                                PropertyDelegate pd = sessionDelegate.getProperty(oakPath);
-                                return pd == null ? null : new PropertyImpl(pd, sessionContext);
-                            }
-                        }
-                );
-
-                return new PropertyIteratorAdapter(properties.iterator(), propertyOakPaths.size());
-            }
-        });
-    }
-
     @Override
     public boolean hasNode(final String relPath) throws RepositoryException {
         return perform(new ItemReadOperation<Boolean>() {
             @Override
             public Boolean perform() throws RepositoryException {
-                String oakPath = getOakPath(relPath);
+                String oakPath = getOakPathOrThrow(relPath);
                 return dlg.getChild(oakPath) != null;
             }
         });
@@ -801,7 +784,7 @@ public class NodeImpl<T extends NodeDele
         return perform(new ItemReadOperation<Boolean>() {
             @Override
             public Boolean perform() throws RepositoryException {
-                String oakPath = getOakPath(relPath);
+                String oakPath = getOakPathOrThrow(relPath);
                 return dlg.getProperty(oakPath) != null;
             }
         });
@@ -872,17 +855,15 @@ public class NodeImpl<T extends NodeDele
         });
     }
 
-    @Nonnull
-    private EffectiveNodeTypeProvider getEffectiveNodeTypeProvider() {
-        return sessionContext.getEffectiveNodeTypeProvider();
-    }
-
     @Override
     public boolean isNodeType(final String nodeTypeName) throws RepositoryException {
-        checkStatus();
-
-        String oakName = getOakName(nodeTypeName);
-        return getEffectiveNodeTypeProvider().isNodeType(dlg.getTree(), oakName);
+        return perform(new ItemReadOperation<Boolean>() {
+            @Override
+            protected Boolean perform() throws RepositoryException {
+                String oakName = getOakName(nodeTypeName);
+                return getEffectiveNodeTypeProvider().isNodeType(dlg.getTree(), oakName);
+            }
+        });
     }
 
     @Override
@@ -971,20 +952,21 @@ public class NodeImpl<T extends NodeDele
         });
     }
 
-    private EffectiveNodeType getEffectiveNodeType() throws RepositoryException {
-        return getEffectiveNodeTypeProvider().getEffectiveNodeType(dlg.getTree());
-    }
-
     @Override
     @Nonnull
     public NodeDefinition getDefinition() throws RepositoryException {
-        NodeDelegate parent = dlg.getParent();
-        if (parent == null) {
-            return getDefinitionProvider().getRootDefinition();
-        } else {
-            return getDefinitionProvider().getDefinition(
-                    parent.getTree(), dlg.getTree());
-        }
+        return perform(new ItemReadOperation<NodeDefinition>() {
+            @Override
+            protected NodeDefinition perform() throws RepositoryException {
+                NodeDelegate parent = dlg.getParent();
+                if (parent == null) {
+                    return getDefinitionProvider().getRootDefinition();
+                } else {
+                    return getDefinitionProvider().getDefinition(
+                            parent.getTree(), dlg.getTree());
+                }
+            }
+        });
     }
 
     @Override
@@ -1000,14 +982,15 @@ public class NodeImpl<T extends NodeDele
     public void update(String srcWorkspace) throws RepositoryException {
         checkStatus();
         checkValidWorkspace(srcWorkspace);
-        ensureNoPendingSessionChanges();
 
-        // TODO
-    }
+        // check for pending changes
+        if (sessionDelegate.hasPendingChanges()) {
+            String msg = "Unable to perform operation. Session has pending changes.";
+            log.debug(msg);
+            throw new InvalidItemStateException(msg);
+        }
 
-    @Nonnull
-    private VersionManager getVersionManager() throws RepositoryException {
-        return sessionContext.getVersionManager();
+        // TODO
     }
 
     /**
@@ -1130,27 +1113,32 @@ public class NodeImpl<T extends NodeDele
      */
     @Override
     public boolean isLocked() throws RepositoryException {
-        String lockOwner = getOakPath(JCR_LOCK_OWNER);
-        String lockIsDeep = getOakPath(JCR_LOCK_IS_DEEP);
+        return perform(new ItemReadOperation<Boolean>() {
+            @Override
+            protected Boolean perform() throws RepositoryException {
+                String lockOwner = getOakPathOrThrow(JCR_LOCK_OWNER);
+                String lockIsDeep = getOakPathOrThrow(JCR_LOCK_IS_DEEP);
 
-        if (dlg.getProperty(lockOwner) != null) {
-            return true;
-        }
+                if (dlg.getProperty(lockOwner) != null) {
+                    return true;
+                }
 
-        NodeDelegate parent = dlg.getParent();
-        while (parent != null) {
-            if (parent.getProperty(lockOwner) != null) {
-                PropertyDelegate isDeep = parent.getProperty(lockIsDeep);
-                if (isDeep != null && !isDeep.isArray()) {
-                    if (isDeep.getBoolean()) {
-                        return true;
+                NodeDelegate parent = dlg.getParent();
+                while (parent != null) {
+                    if (parent.getProperty(lockOwner) != null) {
+                        PropertyDelegate isDeep = parent.getProperty(lockIsDeep);
+                        if (isDeep != null && !isDeep.isArray()) {
+                            if (isDeep.getBoolean()) {
+                                return true;
+                            }
+                        }
                     }
+                    parent = parent.getParent();
                 }
-            }
-            parent = parent.getParent();
-        }
 
-        return false;
+                return false;
+            }
+        });
     }
 
     /**
@@ -1159,8 +1147,13 @@ public class NodeImpl<T extends NodeDele
      */
     @Override
     public boolean holdsLock() throws RepositoryException {
-        String lockOwner = getOakPath(JCR_LOCK_OWNER);
-        return dlg.getProperty(lockOwner) != null;
+        return perform(new ItemReadOperation<Boolean>() {
+            @Override
+            protected Boolean perform() throws RepositoryException {
+                String lockOwner = getOakPathOrThrow(JCR_LOCK_OWNER);
+                return dlg.getProperty(lockOwner) != null;
+            }
+        });
     }
 
     /**
@@ -1179,12 +1172,12 @@ public class NodeImpl<T extends NodeDele
     @Nonnull
     public Lock lock(final boolean isDeep, boolean isSessionScoped)
             throws RepositoryException {
-        final String userID = getSession().getUserID();
+        ContentSession session = sessionDelegate.getContentSession();
+        final String userID = session.getAuthInfo().getUserID();
 
-        String lockOwner = getOakPath(JCR_LOCK_OWNER);
-        String lockIsDeep = getOakPath(JCR_LOCK_IS_DEEP);
+        String lockOwner = getOakPathOrThrow(JCR_LOCK_OWNER);
+        String lockIsDeep = getOakPathOrThrow(JCR_LOCK_IS_DEEP);
         try {
-            ContentSession session = sessionDelegate.getContentSession();
             Root root = session.getLatestRoot();
             Tree tree = root.getTree(dlg.getPath());
             if (tree == null) {
@@ -1255,8 +1248,8 @@ public class NodeImpl<T extends NodeDele
      */
     @Override
     public void unlock() throws RepositoryException {
-        String lockOwner = getOakPath(JCR_LOCK_OWNER);
-        String lockIsDeep = getOakPath(JCR_LOCK_IS_DEEP);
+        String lockOwner = getOakPathOrThrow(JCR_LOCK_OWNER);
+        String lockIsDeep = getOakPathOrThrow(JCR_LOCK_IS_DEEP);
         try {
             Root root = sessionDelegate.getContentSession().getLatestRoot();
             Tree tree = root.getTree(dlg.getPath());
@@ -1276,17 +1269,26 @@ public class NodeImpl<T extends NodeDele
     @Override
     @Nonnull
     public NodeIterator getSharedSet() throws RepositoryException {
-        checkStatus();
-        checkProtected();
-        return new NodeIteratorAdapter(ImmutableSet.of(this));
+        return perform(new ItemReadOperation<NodeIterator>() {
+            @Override
+            protected NodeIterator perform() {
+                return new NodeIteratorAdapter(ImmutableSet.of(this));
+            }
+        });
     }
 
     @Override
     public void removeSharedSet() throws RepositoryException {
-        NodeIterator sharedSet = getSharedSet();
-        while (sharedSet.hasNext()) {
-            sharedSet.nextNode().removeShare();
-        }
+        perform(new ItemWriteOperation<Void>() {
+            @Override
+            protected Void perform() throws RepositoryException {
+                NodeIterator sharedSet = getSharedSet();
+                while (sharedSet.hasNext()) {
+                    sharedSet.nextNode().removeShare();
+                }
+                return null;
+            }
+        });
     }
 
     @Override
@@ -1314,6 +1316,10 @@ public class NodeImpl<T extends NodeDele
 
     //------------------------------------------------------------< private >---
 
+    private EffectiveNodeType getEffectiveNodeType() throws RepositoryException {
+        return getEffectiveNodeTypeProvider().getEffectiveNodeType(dlg.getTree());
+    }
+
     private Iterator<Node> nodeIterator(Iterator<NodeDelegate> childNodes) {
         return Iterators.transform(
                 childNodes,
@@ -1360,7 +1366,7 @@ public class NodeImpl<T extends NodeDele
     }
 
     private void autoCreateItems() throws RepositoryException {
-        EffectiveNodeType effective = getEffectiveNodeTypeProvider().getEffectiveNodeType(dlg.getTree());
+        EffectiveNodeType effective = getEffectiveNodeType();
         for (PropertyDefinition pd : effective.getAutoCreatePropertyDefinitions()) {
             if (dlg.getProperty(pd.getName()) == null) {
                 if (pd.isMultiple()) {
@@ -1459,7 +1465,7 @@ public class NodeImpl<T extends NodeDele
         }
         // TODO: END
 
-        String jcrPrimaryType = getOakPath(Property.JCR_PRIMARY_TYPE);
+        String jcrPrimaryType = getOakPathOrThrow(Property.JCR_PRIMARY_TYPE);
         Value value = getValueFactory().createValue(nodeTypeName, PropertyType.NAME);
 
         dlg.setProperty(PropertyStates.createProperty(jcrPrimaryType, value));
@@ -1469,7 +1475,7 @@ public class NodeImpl<T extends NodeDele
     private Property internalSetProperty(
             String jcrName, final Value value, final boolean exactTypeMatch)
             throws RepositoryException {
-        final String oakName = getOakPath(checkNotNull(jcrName));
+        final String oakName = getOakPathOrThrow(checkNotNull(jcrName));
         checkNotNull(value);
         return perform(new ItemWriteOperation<Property>() {
             @Override
@@ -1502,7 +1508,7 @@ public class NodeImpl<T extends NodeDele
             String jcrName, Value[] values,
             final int type, final boolean exactTypeMatch)
             throws RepositoryException {
-        final String oakName = getOakPath(checkNotNull(jcrName));
+        final String oakName = getOakPathOrThrow(checkNotNull(jcrName));
         final Value[] nonNullValues = compact(checkNotNull(values));
         return perform(new ItemWriteOperation<Property>() {
             @Override
@@ -1533,7 +1539,7 @@ public class NodeImpl<T extends NodeDele
 
     private Property internalRemoveProperty(final String jcrName)
             throws RepositoryException {
-        final String oakName = getOakPath(checkNotNull(jcrName));
+        final String oakName = getOakPathOrThrow(checkNotNull(jcrName));
         return perform(new ItemWriteOperation<Property>() {
             @Override
             protected Property perform() throws RepositoryException {

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java?rev=1461230&r1=1461229&r2=1461230&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java Tue Mar 26 17:01:03 2013
@@ -163,7 +163,7 @@ public class PropertyImpl extends ItemIm
      */
     @Override
     public void setValue(final Value[] values) throws RepositoryException {
-        perform(new ItemReadOperation<Void>() {
+        perform(new ItemWriteOperation<Void>() {
             @Override
             public Void perform() throws RepositoryException {
                 // assert equal types for all values entries
@@ -529,7 +529,12 @@ public class PropertyImpl extends ItemIm
     @Override
     @Nonnull
     public PropertyDefinition getDefinition() throws RepositoryException {
-        return getDefinitionProvider().getDefinition(getParent(), this);
+        return perform(new ItemReadOperation<PropertyDefinition>() {
+            @Override
+            protected PropertyDefinition perform() throws RepositoryException {
+                return getDefinitionProvider().getDefinition(getParent(), PropertyImpl.this);
+            }
+        });
     }
 
     /**

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=1461230&r1=1461229&r2=1461230&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 Tue Mar 26 17:01:03 2013
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
+import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.NODE_TYPES_PATH;
+
 import java.io.IOException;
 import java.io.InputStream;
 
@@ -49,8 +51,6 @@ import org.apache.jackrabbit.util.Text;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
 
-import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.NODE_TYPES_PATH;
-
 /**
  * TODO document
  */
@@ -217,7 +217,7 @@ public class WorkspaceImpl implements Ja
 
     @Override
     public NodeTypeManager getNodeTypeManager() {
-        return getReadWriteNodeTypeManager();
+        return nodeTypeManager;
     }
 
     @Override