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 2012/04/10 20:00:57 UTC

svn commit: r1311891 - in /jackrabbit/oak/trunk/oak-jcr/src: main/java/org/apache/jackrabbit/oak/jcr/ test/java/org/apache/jackrabbit/oak/jcr/

Author: mduerig
Date: Tue Apr 10 18:00:56 2012
New Revision: 1311891

URL: http://svn.apache.org/viewvc?rev=1311891&view=rev
Log:
OAK-15: Clean up oak-jcr
resolve states on access

Added:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemStateProvider.java
Modified:
    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/SessionContext.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java

Added: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemStateProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemStateProvider.java?rev=1311891&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemStateProvider.java (added)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemStateProvider.java Tue Apr 10 18:00:56 2012
@@ -0,0 +1,37 @@
+package org.apache.jackrabbit.oak.jcr;
+
+import org.apache.jackrabbit.mk.model.PropertyState;
+import org.apache.jackrabbit.mk.util.PathUtils;
+import org.apache.jackrabbit.oak.kernel.TransientNodeState;
+
+public class ItemStateProvider {
+    private final TransientNodeState root;
+
+    ItemStateProvider(TransientNodeState root) {
+        this.root = root;
+    }
+
+    TransientNodeState getNodeState(String path){
+        TransientNodeState state = root;
+
+        for (String name : PathUtils.elements(path)) {
+            state = state.getChildNode(name);
+            if (state == null) {
+                return null;
+            }
+        }
+
+        return state;
+    }
+
+    PropertyState getPropertyState(String path) {
+        TransientNodeState parentState = getNodeState(PathUtils.getParentPath(path));
+
+        if (parentState == null) {
+            return null;
+        }
+        else {
+            return parentState.getProperty(PathUtils.getName(path));
+        }
+    }
+}

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=1311891&r1=1311890&r2=1311891&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 Apr 10 18:00:56 2012
@@ -19,7 +19,6 @@ package org.apache.jackrabbit.oak.jcr;
 import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.commons.iterator.NodeIteratorAdapter;
 import org.apache.jackrabbit.commons.iterator.PropertyIteratorAdapter;
-import org.apache.jackrabbit.mk.model.NodeStateEditor;
 import org.apache.jackrabbit.mk.model.PropertyState;
 import org.apache.jackrabbit.mk.model.ScalarImpl;
 import org.apache.jackrabbit.mk.util.PathUtils;
@@ -72,11 +71,11 @@ public class NodeImpl extends ItemImpl i
      */
     private static final Logger log = LoggerFactory.getLogger(NodeImpl.class);
 
-    private final NodeStateEditor editor;
+    private TransientNodeState nodeState;
 
-    NodeImpl(SessionContext<SessionImpl> sessionContext, NodeStateEditor editor) {
+    NodeImpl(SessionContext<SessionImpl> sessionContext, TransientNodeState nodeState) {
         super(sessionContext);
-        this.editor = editor;
+        this.nodeState = nodeState;
     }
 
     //---------------------------------------------------------------< Item >---
@@ -93,7 +92,7 @@ public class NodeImpl extends ItemImpl i
      */
     @Override
     public String getName() throws RepositoryException {
-        return state().getName();
+        return getNodeState().getName();
     }
 
     /**
@@ -109,11 +108,11 @@ public class NodeImpl extends ItemImpl i
      */
     @Override
     public Node getParent() throws RepositoryException {
-        if (state().getParent() == null) {
+        if (getNodeState().getParent() == null) {
             throw new ItemNotFoundException("Root has no parent");
         }
 
-        return new NodeImpl(sessionContext, state().getParent().getEditor());
+        return new NodeImpl(sessionContext, getNodeState().getParent());
     }
 
     /**
@@ -156,7 +155,7 @@ public class NodeImpl extends ItemImpl i
      */
     @Override
     public void remove() throws RepositoryException {
-        state().getParent().getEditor().removeNode(getName());
+        getNodeState().getParent().getEditor().removeNode(getName());
     }
 
     /**
@@ -176,17 +175,15 @@ public class NodeImpl extends ItemImpl i
     public Node addNode(String relPath) throws RepositoryException {
         checkStatus();
 
-        NodeStateEditor editor = this.editor;
-        for (String name : PathUtils.elements(PathUtils.getParentPath(relPath))) {
-            editor = editor.edit(name);
-            if (editor == null) {
-                throw new PathNotFoundException();
-            }
+        String parentPath = PathUtils.concat(path(), PathUtils.getParentPath(relPath));
+        TransientNodeState parentState = getItemStateProvider().getNodeState(parentPath);
+        if (parentState == null) {
+            throw new PathNotFoundException(relPath);
         }
 
         String name = PathUtils.getName(relPath);
-        editor.addNode(name);
-        return new NodeImpl(sessionContext, editor.edit(name));
+        parentState.getEditor().addNode(name);
+        return new NodeImpl(sessionContext, parentState.getChildNode(name));
     }
 
     @Override
@@ -223,7 +220,7 @@ public class NodeImpl extends ItemImpl i
     public Property setProperty(String name, Value value, int type) throws RepositoryException {
         checkStatus();
 
-        editor.setProperty(name, ValueConverter.toScalar(value));
+        getEditor().setProperty(name, ValueConverter.toScalar(value));
         return getProperty(name);
     }
 
@@ -245,7 +242,7 @@ public class NodeImpl extends ItemImpl i
     public Property setProperty(String name, Value[] values, int type) throws RepositoryException {
         checkStatus();
 
-        editor.setProperty(name, ValueConverter.toScalar(values));
+        getEditor().setProperty(name, ValueConverter.toScalar(values));
         return getProperty(name);
     }
 
@@ -376,7 +373,7 @@ public class NodeImpl extends ItemImpl i
     public NodeIterator getNodes() throws RepositoryException {
         checkStatus();
 
-        Iterable<TransientNodeState> childNodeStates = state().getChildNodes();
+        Iterable<TransientNodeState> childNodeStates = getNodeState().getChildNodes();
         return new NodeIteratorAdapter(nodeIterator(childNodeStates.iterator()));
     }
 
@@ -384,7 +381,7 @@ public class NodeImpl extends ItemImpl i
     public NodeIterator getNodes(final String namePattern) throws RepositoryException {
         checkStatus();
 
-        Iterator<TransientNodeState> childNodeStates = filter(state().getChildNodes().iterator(),
+        Iterator<TransientNodeState> childNodeStates = filter(getNodeState().getChildNodes().iterator(),
                 new Predicate<TransientNodeState>() {
                     @Override
                     public boolean evaluate(TransientNodeState state) {
@@ -399,7 +396,7 @@ public class NodeImpl extends ItemImpl i
     public NodeIterator getNodes(final String[] nameGlobs) throws RepositoryException {
         checkStatus();
 
-        Iterator<TransientNodeState> childNodeStates = filter(state().getChildNodes().iterator(),
+        Iterator<TransientNodeState> childNodeStates = filter(getNodeState().getChildNodes().iterator(),
                 new Predicate<TransientNodeState>() {
                     @Override
                     public boolean evaluate(TransientNodeState state) {
@@ -426,7 +423,7 @@ public class NodeImpl extends ItemImpl i
     public PropertyIterator getProperties() throws RepositoryException {
         checkStatus();
 
-        Iterable<PropertyState> properties = state().getProperties();
+        Iterable<PropertyState> properties = getNodeState().getProperties();
         return new PropertyIteratorAdapter(propertyIterator(properties.iterator()));
     }
 
@@ -434,7 +431,7 @@ public class NodeImpl extends ItemImpl i
     public PropertyIterator getProperties(final String namePattern) throws RepositoryException {
         checkStatus();
 
-        Iterator<PropertyState> properties = filter(state().getProperties().iterator(),
+        Iterator<PropertyState> properties = filter(getNodeState().getProperties().iterator(),
                 new Predicate<PropertyState>() {
                     @Override
                     public boolean evaluate(PropertyState entry) {
@@ -447,7 +444,7 @@ public class NodeImpl extends ItemImpl i
 
     @Override
     public PropertyIterator getProperties(final String[] nameGlobs) throws RepositoryException {
-        Iterator<PropertyState> propertyNames = filter(state().getProperties().iterator(),
+        Iterator<PropertyState> propertyNames = filter(getNodeState().getProperties().iterator(),
                 new Predicate<PropertyState>() {
                     @Override
                     public boolean evaluate(PropertyState entry) {
@@ -555,14 +552,14 @@ public class NodeImpl extends ItemImpl i
     public boolean hasNodes() throws RepositoryException {
         checkStatus();
 
-        return state().getChildNodeCount() != 0;
+        return getNodeState().getChildNodeCount() != 0;
     }
 
     @Override
     public boolean hasProperties() throws RepositoryException {
         checkStatus();
 
-        return state().getPropertyCount() != 0;
+        return getNodeState().getPropertyCount() != 0;
     }
 
     @Override
@@ -593,7 +590,7 @@ public class NodeImpl extends ItemImpl i
     public void setPrimaryType(String nodeTypeName) throws RepositoryException {
         checkStatus();
 
-        editor.setProperty(JcrConstants.JCR_PRIMARYTYPE, ScalarImpl.stringScalar(nodeTypeName));
+        getEditor().setProperty(JcrConstants.JCR_PRIMARYTYPE, ScalarImpl.stringScalar(nodeTypeName));
     }
 
     @Override
@@ -818,11 +815,6 @@ public class NodeImpl extends ItemImpl i
 
     }
 
-    //-----------------------------------------------------< implementation >---
-    public NodeStateEditor getEditor() {
-        return editor;
-    }
-
     //------------------------------------------------------------< private >---
     /**
      * Shortcut to retrieve the version manager from the workspace associated
@@ -846,20 +838,27 @@ public class NodeImpl extends ItemImpl i
         return getSession().getWorkspace().getLockManager();
     }
 
-    private TransientNodeState state() {
-        // fixme: need to resolve state in case a refresh occurred
-        return ((KernelNodeStateEditor) editor).getTransientState();
+    private ItemStateProvider getItemStateProvider() {
+        return sessionContext.getItemStateProvider();
+    }
+    
+    private TransientNodeState getNodeState() {
+        return nodeState = getItemStateProvider().getNodeState(nodeState.getPath());
+    }
+
+    private KernelNodeStateEditor getEditor() {
+        return getNodeState().getEditor();
     }
 
     private String path() {
-        return state().getPath();
+        return getNodeState().getPath();
     }
 
     private Iterator<Node> nodeIterator(Iterator<TransientNodeState> childNodeStates) {
         return Iterators.map(childNodeStates, new Function1<TransientNodeState, Node>() {
             @Override
             public Node apply(TransientNodeState state) {
-                return new NodeImpl(sessionContext, state.getEditor());
+                return new NodeImpl(sessionContext, state);
             }
         });
     }
@@ -868,39 +867,30 @@ public class NodeImpl extends ItemImpl i
         return Iterators.map(properties, new Function1<PropertyState, Property>() {
             @Override
             public Property apply(PropertyState propertyState) {
-                return new PropertyImpl(sessionContext, editor, propertyState);
+                return new PropertyImpl(sessionContext, getNodeState(), propertyState);
             }
         });
     }
 
     private NodeImpl getNodeOrNull(String relPath) {
-        NodeStateEditor editor = this.editor;
-
-        for (String name : PathUtils.elements(relPath)) {
-            editor = editor.edit(name);
-            if (editor == null) {
-                return null;
-            }
-        }
-
-        return new NodeImpl(sessionContext, editor);
+        String absPath = PathUtils.concat(path(), relPath);
+        TransientNodeState nodeState = getItemStateProvider().getNodeState(absPath);
+        return nodeState == null
+            ? null
+            : new NodeImpl(sessionContext, nodeState);
     }
     
     private PropertyImpl getPropertyOrNull(String relPath) {
-        String parentPath = PathUtils.getParentPath(relPath);
-        NodeStateEditor editor = this.editor;
-        for (String name : PathUtils.elements(parentPath)) {
-            editor = editor.edit(name);
-            if (editor == null) {
-                return null;
-            }
+        String absPath = PathUtils.concat(path(), PathUtils.getParentPath(relPath));
+        TransientNodeState parentState = getItemStateProvider().getNodeState(absPath);
+        if (parentState == null) {
+            return null;
         }
 
         String name = PathUtils.getName(relPath);
-        // fixme: don't cast to implementation
-        PropertyState state = ((KernelNodeStateEditor) editor).getTransientState().getProperty(name);
-        return state == null
+        PropertyState propertyState = parentState.getProperty(name);
+        return propertyState == null
             ? null
-            : new PropertyImpl(sessionContext, editor, state);
+            : new PropertyImpl(sessionContext, parentState, propertyState);
     }
 }
\ No newline at end of file

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=1311891&r1=1311890&r2=1311891&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 Apr 10 18:00:56 2012
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
-import org.apache.jackrabbit.mk.model.NodeStateEditor;
 import org.apache.jackrabbit.mk.model.PropertyState;
 import org.apache.jackrabbit.mk.util.PathUtils;
 import org.apache.jackrabbit.oak.jcr.util.LogUtil;
@@ -53,12 +52,14 @@ public class PropertyImpl extends ItemIm
      */
     private static final Logger log = LoggerFactory.getLogger(PropertyImpl.class);
 
-    private final NodeStateEditor parentEditor;
-    private final PropertyState propertyState;
+    private TransientNodeState parentState;
+    private PropertyState propertyState;
+
+    PropertyImpl(SessionContext<SessionImpl> sessionContext, TransientNodeState parentState,
+            PropertyState propertyState) {
 
-    PropertyImpl(SessionContext<SessionImpl> sessionContext, NodeStateEditor parentEditor, PropertyState propertyState) {
         super(sessionContext);
-        this.parentEditor = parentEditor;
+        this.parentState = parentState;
         this.propertyState = propertyState;
     }
 
@@ -76,7 +77,7 @@ public class PropertyImpl extends ItemIm
      */
     @Override
     public String getName() throws RepositoryException {
-        return propertyState.getName();
+        return getStateName();
     }
 
     /**
@@ -84,7 +85,7 @@ public class PropertyImpl extends ItemIm
      */
     @Override
     public String getPath() throws RepositoryException {
-        return '/' + parentState().getPath() + '/' + propertyState.getName();
+        return '/' + getParentState().getPath() + '/' + getStateName();
     }
 
     /**
@@ -92,7 +93,7 @@ public class PropertyImpl extends ItemIm
      */
     @Override
     public Node getParent() throws RepositoryException {
-        return new NodeImpl(sessionContext, parentEditor);
+        return new NodeImpl(sessionContext, getParentState());
     }
 
     /**
@@ -138,7 +139,7 @@ public class PropertyImpl extends ItemIm
      */
     @Override
     public void remove() throws RepositoryException {
-        parentEditor.removeProperty(propertyState.getName());
+        getEditor().removeProperty(getStateName());
     }
 
     /**
@@ -339,7 +340,7 @@ public class PropertyImpl extends ItemIm
             throw new ValueFormatException(LogUtil.safeGetJCRPath(this) + " is multi-valued.");
         }
 
-        return ValueConverter.toValue(getValueFactory(), propertyState.getScalar());
+        return ValueConverter.toValue(getValueFactory(), getPropertyState().getScalar());
     }
 
     @Override
@@ -349,7 +350,7 @@ public class PropertyImpl extends ItemIm
             throw new ValueFormatException(LogUtil.safeGetJCRPath(this) + " is not multi-valued.");
         }
 
-        return ValueConverter.toValues(getValueFactory(), propertyState.getArray());
+        return ValueConverter.toValues(getValueFactory(), getPropertyState().getArray());
     }
 
     /**
@@ -524,7 +525,7 @@ public class PropertyImpl extends ItemIm
      */
     @Override
     public boolean isMultiple() throws RepositoryException {
-        return propertyState.isArray();
+        return getPropertyState().isArray();
     }
 
     //------------------------------------------------------------< private >---
@@ -562,8 +563,9 @@ public class PropertyImpl extends ItemIm
 
         if (value == null) {
             remove();
-        } else {
-            parentEditor.setProperty(propertyState.getName(), ValueConverter.toScalar(value));
+        }
+        else {
+            getEditor().setProperty(getStateName(), ValueConverter.toScalar(value));
         }
     }
 
@@ -581,8 +583,9 @@ public class PropertyImpl extends ItemIm
 
         if (values == null) {
             remove();
-        } else {
-            parentEditor.setProperty(propertyState.getName(), ValueConverter.toScalar(values));
+        }
+        else {
+            getEditor().setProperty(getStateName(), ValueConverter.toScalar(values));
         }
     }
 
@@ -602,9 +605,32 @@ public class PropertyImpl extends ItemIm
         }
     }
 
-    private TransientNodeState parentState() {
-        // fixme: resolve parent state in case a refresh has occurred
-        return ((KernelNodeStateEditor) parentEditor).getTransientState();
+    private ItemStateProvider getItemStateProvider() {
+        return sessionContext.getItemStateProvider();
+    }
+
+    private TransientNodeState getParentState() {
+        resolve();
+        return parentState;
+    }
+
+    private KernelNodeStateEditor getEditor() {
+        return getParentState().getEditor();
+    }
+
+    private PropertyState getPropertyState() {
+        resolve();
+        return propertyState;
+    }
+
+    private String getStateName() {
+        return getPropertyState().getName();
+    }
+
+    private void resolve() {
+        parentState = getItemStateProvider().getNodeState(parentState.getPath());
+        propertyState = getItemStateProvider().getPropertyState(
+                PathUtils.concat(parentState.getPath(), propertyState.getName()));
     }
 
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java?rev=1311891&r1=1311890&r2=1311891&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java Tue Apr 10 18:00:56 2012
@@ -30,4 +30,5 @@ public interface SessionContext<T extend
     String getWorkspaceName();
     Connection getConnection();
     ValueFactory getValueFactory();
+    ItemStateProvider getItemStateProvider();
 }

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=1311891&r1=1311890&r2=1311891&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 Tue Apr 10 18:00:56 2012
@@ -21,6 +21,7 @@ import org.apache.jackrabbit.mk.model.No
 import org.apache.jackrabbit.mk.model.NodeStateEditor;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.Connection;
+import org.apache.jackrabbit.oak.kernel.KernelNodeStateEditor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.ContentHandler;
@@ -53,21 +54,24 @@ public class SessionImpl extends Abstrac
     private final Workspace workspace;
     private final Connection connection;
     private final ValueFactory valueFactory;
-
     private final GlobalContext globalContext;
     private final SessionContext<SessionImpl> sessionContext = new Context();
+    private boolean isAlive = true;
 
     private NodeStateEditor editor;
-    private boolean isAlive = true;
+    private ItemStateProvider itemStateProvider;
 
     SessionImpl(GlobalContext globalContext, Repository repository, Connection connection) {
 
         this.globalContext = globalContext;
         this.repository = repository;
         this.connection = connection;
+        this.valueFactory = new ValueFactoryImpl();
+
+        this.editor = connection.getNodeStateEditor(connection.getCurrentRoot());
+        // fixme: don't cast to implementation
+        this.itemStateProvider = new ItemStateProvider(((KernelNodeStateEditor) editor).getTransientState());
 
-        editor = connection.getNodeStateEditor(connection.getCurrentRoot());
-        valueFactory = new ValueFactoryImpl();
         workspace = new WorkspaceImpl(sessionContext);
     }
 
@@ -121,7 +125,7 @@ public class SessionImpl extends Abstrac
     @Override
     public Node getRootNode() throws RepositoryException {
         checkIsAlive();
-        return new NodeImpl(sessionContext, editor);
+        return new NodeImpl(sessionContext, itemStateProvider.getNodeState("/"));
     }
 
     @Override
@@ -156,6 +160,8 @@ public class SessionImpl extends Abstrac
         try {
             NodeState newState = connection.commit(editor);
             editor = connection.getNodeStateEditor(newState);
+            // fixme: don't cast to implementation
+            itemStateProvider = new ItemStateProvider(((KernelNodeStateEditor) editor).getTransientState());
         } catch (CommitFailedException e) {
             throw new RepositoryException(e);
         }
@@ -165,7 +171,11 @@ public class SessionImpl extends Abstrac
     public void refresh(boolean keepChanges) throws RepositoryException {
         checkIsAlive();
         try {
-            connection.commit(connection.getNodeStateEditor(connection.getCurrentRoot()));  // todo: need a better way to update a connection to head
+            // todo: need a better way to update a connection to head
+            NodeState newState = connection.commit(connection.getNodeStateEditor(connection.getCurrentRoot()));
+            editor = connection.getNodeStateEditor(newState);
+            // fixme: don't cast to implementation
+            itemStateProvider = new ItemStateProvider(((KernelNodeStateEditor) editor).getTransientState());
         } catch (CommitFailedException e) {
             throw new RepositoryException(e);
         }
@@ -437,5 +447,9 @@ public class SessionImpl extends Abstrac
             return valueFactory;
         }
 
+        @Override
+        public ItemStateProvider getItemStateProvider() {
+            return itemStateProvider;
+        }
     }
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java?rev=1311891&r1=1311890&r2=1311891&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java Tue Apr 10 18:00:56 2012
@@ -878,7 +878,6 @@ public class RepositoryTest extends Abst
     }
 
     @Test
-    @Ignore("WIP")  // fixme
     public void setStringProperty() throws RepositoryException, IOException {
         Node parentNode = getNode(TEST_PATH);
         addProperty(parentNode, "string", getSession().getValueFactory().createValue("string \" value"));
@@ -914,7 +913,6 @@ public class RepositoryTest extends Abst
     }
 
     @Test
-    @Ignore("WIP") // fixme
     public void setMultiValuedProperty() throws RepositoryException {
         Node parentNode = getNode(TEST_PATH);
         Value[] values = new Value[2];
@@ -1016,7 +1014,6 @@ public class RepositoryTest extends Abst
     }
 
     @Test
-    @Ignore("WIP")  // fixme
     public void sessionSave() throws RepositoryException {
         Session session1 = getRepository().login();
         Session session2 = getRepository().login();
@@ -1110,7 +1107,6 @@ public class RepositoryTest extends Abst
     }
 
     @Test
-    @Ignore("WIP")  // fixme
     public void sessionRefreshFalse() throws RepositoryException {
         Session session = getRepository().login();
         try {