jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1333607 - in /jackrabbit/oak/trunk: oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/privileges/ oak-jcr/src/main/j...
Date Thu, 03 May 2012 20:29:49 GMT
Author: mduerig
Date: Thu May  3 20:29:48 2012
New Revision: 1333607

URL: http://svn.apache.org/viewvc?rev=1333607&view=rev
Log:
OAK-84: Delegates for Session, Node, Property and Item
- Initial implementation of SessionDelegate 
- Remove SessionContext

Added:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
Removed:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
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/NodeDelegate.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/PropertyDelegate.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/RepositoryImpl.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
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryManagerImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/privileges/PrivilegeManagerImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/AuthorizableNodeCreator.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueConverter.java
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/RepositoryServlet.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=1333607&r1=1333606&r2=1333607&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 Thu May  3 20:29:48 2012
@@ -31,7 +31,7 @@ import javax.jcr.ValueFactory;
  */
 abstract class ItemImpl implements Item {
 
-    protected final SessionContext sessionContext;
+    protected final SessionDelegate sessionDelegate;
     protected final ItemDelegate dlg;
 
     /**
@@ -39,8 +39,8 @@ abstract class ItemImpl implements Item 
      */
     private static final Logger log = LoggerFactory.getLogger(ItemImpl.class);
 
-    protected ItemImpl(SessionContext sessionContext, ItemDelegate itemDelegate) {
-        this.sessionContext = sessionContext;
+    protected ItemImpl(SessionDelegate sessionDelegate, ItemDelegate itemDelegate) {
+        this.sessionDelegate = sessionDelegate;
         this.dlg = itemDelegate;
     }
 
@@ -75,7 +75,7 @@ abstract class ItemImpl implements Item 
 
     @Override
     public Session getSession() throws RepositoryException {
-        return sessionContext.getSession();
+        return sessionDelegate.getSession();
     }
 
     /**
@@ -142,7 +142,10 @@ abstract class ItemImpl implements Item 
      */
     void checkStatus() throws RepositoryException {
         // check session status
-        sessionContext.getSession().ensureIsAlive();
+
+        if (!sessionDelegate.isAlive()) {
+            throw new RepositoryException("This session has been closed.");
+        }
 
         // TODO: validate item state.
     }
@@ -155,7 +158,12 @@ abstract class ItemImpl implements Item 
      * @throws RepositoryException
      */
     void ensureNoPendingSessionChanges() throws RepositoryException {
-        sessionContext.getSession().ensureNoPendingChanges();
+        // check for pending changes
+        if (sessionDelegate.hasPendingChanges()) {
+            String msg = "Unable to perform operation. Session has pending changes.";
+            log.debug(msg);
+            throw new InvalidItemStateException(msg);
+        }
     }
 
     /**
@@ -164,13 +172,13 @@ abstract class ItemImpl implements Item 
      * @return the value factory
      */
     ValueFactory getValueFactory() {
-        return sessionContext.getValueFactory();
+        return sessionDelegate.getValueFactory();
     }
 
     
     String toOakPath(String jcrPath) throws RepositoryException {
         try {
-            return sessionContext.getNamePathMapper().toOakPath(jcrPath);
+            return sessionDelegate.getNamePathMapper().toOakPath(jcrPath);
         } catch (IllegalArgumentException ex) {
             // TODO we shouldn't have to catch this one
             throw new RepositoryException(ex);
@@ -178,6 +186,6 @@ abstract class ItemImpl implements Item 
     }
 
     String toJcrPath(String oakPath) {
-        return sessionContext.getNamePathMapper().toJcrPath(oakPath);
+        return sessionDelegate.getNamePathMapper().toJcrPath(oakPath);
     }
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java?rev=1333607&r1=1333606&r2=1333607&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java Thu May  3 20:29:48 2012
@@ -33,11 +33,11 @@ import java.util.List;
 
 public class NodeDelegate extends ItemDelegate {
 
-    private final SessionContext sessionContext;
+    private final SessionDelegate sessionDelegate;
     private Tree tree;
 
-    NodeDelegate(SessionContext sessionContext, Tree tree) {
-        this.sessionContext = sessionContext;
+    NodeDelegate(SessionDelegate sessionDelegate, Tree tree) {
+        this.sessionDelegate = sessionDelegate;
         this.tree = tree;
     }
 
@@ -49,7 +49,7 @@ public class NodeDelegate extends ItemDe
 
         String name = PathUtils.getName(relPath);
         parentState.addChild(name);
-        return new NodeDelegate(sessionContext, parentState.getChild(name));
+        return new NodeDelegate(sessionDelegate, parentState.getChild(name));
     }
 
     NodeDelegate getAncestor(int depth) throws RepositoryException {
@@ -63,7 +63,7 @@ public class NodeDelegate extends ItemDe
             ancestor = ancestor.getParent();
             current -= 1;
         }
-        return new NodeDelegate(sessionContext, ancestor);
+        return new NodeDelegate(sessionDelegate, ancestor);
     }
 
     Iterator<NodeDelegate> getChildren() throws RepositoryException {
@@ -85,7 +85,7 @@ public class NodeDelegate extends ItemDe
 
     NodeDelegate getNodeOrNull(String relOakPath) {
         Tree tree = getTree(relOakPath);
-        return tree == null ? null : new NodeDelegate(sessionContext, tree);
+        return tree == null ? null : new NodeDelegate(sessionDelegate, tree);
     }
 
     NodeDelegate getParent() throws RepositoryException {
@@ -93,7 +93,7 @@ public class NodeDelegate extends ItemDe
             throw new ItemNotFoundException("Root has no parent");
         }
 
-        return new NodeDelegate(sessionContext, getTree().getParent());
+        return new NodeDelegate(sessionDelegate, getTree().getParent());
     }
 
     @Override
@@ -120,11 +120,11 @@ public class NodeDelegate extends ItemDe
         String name = PathUtils.getName(relOakPath);
         PropertyState propertyState = parent.getProperty(name);
         return propertyState == null ? null : new PropertyDelegate(
-                sessionContext, parent, propertyState);
+                sessionDelegate, parent, propertyState);
     }
 
-    SessionContext getSessionContext() {
-        return sessionContext;
+    SessionDelegate getSessionDelegate() {
+        return sessionDelegate;
     }
 
     void remove() throws RepositoryException {
@@ -166,7 +166,7 @@ public class NodeDelegate extends ItemDe
     }
     
     private synchronized Tree getTree() {
-        return tree = sessionContext.getTree(tree.getPath());
+        return tree = sessionDelegate.getTree(tree.getPath());
     }
 
     private Iterator<NodeDelegate> nodeDelegateIterator(
@@ -175,7 +175,7 @@ public class NodeDelegate extends ItemDe
                 new Function1<Tree, NodeDelegate>() {
                     @Override
                     public NodeDelegate apply(Tree state) {
-                        return new NodeDelegate(sessionContext, state);
+                        return new NodeDelegate(sessionDelegate, state);
                     }
                 });
     }
@@ -186,7 +186,7 @@ public class NodeDelegate extends ItemDe
                 new Function1<PropertyState, PropertyDelegate>() {
                     @Override
                     public PropertyDelegate apply(PropertyState propertyState) {
-                        return new PropertyDelegate(sessionContext, tree,
+                        return new PropertyDelegate(sessionDelegate, tree,
                                 propertyState);
                     }
                 });

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=1333607&r1=1333606&r2=1333607&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 Thu May  3 20:29:48 2012
@@ -72,7 +72,7 @@ public class NodeImpl extends ItemImpl i
     private final NodeDelegate dlg;
     
     NodeImpl(NodeDelegate dlg) {
-        super(dlg.getSessionContext(), dlg);
+        super(dlg.getSessionDelegate(), dlg);
         this.dlg = dlg;
     }
 
@@ -158,7 +158,7 @@ public class NodeImpl extends ItemImpl i
         }
 
         // TODO: figure out the right place for this check
-        NodeTypeManager ntm = sessionContext.getNodeTypeManager();
+        NodeTypeManager ntm = sessionDelegate.getSession().getWorkspace().getNodeTypeManager();
         NodeType nt = ntm.getNodeType(primaryNodeTypeName); // throws on not found
         if (nt.isAbstract() || nt.isMixin()) {
             throw new ConstraintViolationException();
@@ -204,7 +204,7 @@ public class NodeImpl extends ItemImpl i
             p.remove();
             return p;
         } else {
-            CoreValue oakValue = ValueConverter.toCoreValue(targetValue, sessionContext);
+            CoreValue oakValue = ValueConverter.toCoreValue(targetValue, sessionDelegate);
             return new PropertyImpl(dlg.setProperty(toOakPath(jcrName), oakValue));
         }
     }
@@ -234,7 +234,7 @@ public class NodeImpl extends ItemImpl i
             p.remove();
             return p;
         } else {
-            List<CoreValue> oakValue = ValueConverter.toCoreValues(targetValues, sessionContext);
+            List<CoreValue> oakValue = ValueConverter.toCoreValues(targetValues, sessionDelegate);
             return new PropertyImpl(dlg.setProperty(toOakPath(jcrName), oakValue));
         }
     }
@@ -600,10 +600,10 @@ public class NodeImpl extends ItemImpl i
         checkStatus();
 
         // TODO: might be expanded, need a better way for this
-        String jcrName = sessionContext.getNamePathMapper().getJcrName(sessionContext.getNamePathMapper().getOakName(nodeTypeName));
+        String jcrName = sessionDelegate.getNamePathMapper().getJcrName(sessionDelegate.getNamePathMapper().getOakName(nodeTypeName));
 
         // TODO: figure out the right place for this check
-        NodeTypeManager ntm = sessionContext.getNodeTypeManager();
+        NodeTypeManager ntm = sessionDelegate.getSession().getWorkspace().getNodeTypeManager();
         NodeType ntToCheck = ntm.getNodeType(jcrName); // throws on not found
         String nameToCheck = ntToCheck.getName();
 
@@ -627,14 +627,14 @@ public class NodeImpl extends ItemImpl i
         checkStatus();
 
         // TODO: figure out the right place for this check
-        NodeTypeManager ntm = sessionContext.getNodeTypeManager();
+        NodeTypeManager ntm = sessionDelegate.getNodeTypeManager();
         NodeType nt = ntm.getNodeType(nodeTypeName); // throws on not found
         if (nt.isAbstract() || nt.isMixin()) {
             throw new ConstraintViolationException();
         }
         // TODO: END
 
-        CoreValue cv = ValueConverter.toCoreValue(nodeTypeName, PropertyType.NAME, sessionContext);
+        CoreValue cv = ValueConverter.toCoreValue(nodeTypeName, PropertyType.NAME, sessionDelegate);
         dlg.setProperty(toOakPath(Property.JCR_PRIMARY_TYPE), cv);
     }
 
@@ -642,7 +642,7 @@ public class NodeImpl extends ItemImpl i
     public void addMixin(String mixinName) throws RepositoryException {
         checkStatus();
         // TODO: figure out the right place for this check
-        NodeTypeManager ntm = sessionContext.getNodeTypeManager();
+        NodeTypeManager ntm = sessionDelegate.getNodeTypeManager();
         ntm.getNodeType(mixinName); // throws on not found
         // TODO: END
 
@@ -659,7 +659,7 @@ public class NodeImpl extends ItemImpl i
     @Override
     public boolean canAddMixin(String mixinName) throws RepositoryException {
         // TODO: figure out the right place for this check
-        NodeTypeManager ntm = sessionContext.getNodeTypeManager();
+        NodeTypeManager ntm = sessionDelegate.getNodeTypeManager();
         ntm.getNodeType(mixinName); // throws on not found
         // TODO: END
 
@@ -754,7 +754,7 @@ public class NodeImpl extends ItemImpl i
      */
     @Override
     public Version checkin() throws RepositoryException {
-        return sessionContext.getVersionManager().checkin(getPath());
+        return sessionDelegate.getVersionManager().checkin(getPath());
     }
 
     /**
@@ -762,7 +762,7 @@ public class NodeImpl extends ItemImpl i
      */
     @Override
     public void checkout() throws RepositoryException {
-        sessionContext.getVersionManager().checkout(getPath());
+        sessionDelegate.getVersionManager().checkout(getPath());
     }
 
     /**
@@ -770,7 +770,7 @@ public class NodeImpl extends ItemImpl i
      */
     @Override
     public void doneMerge(Version version) throws RepositoryException {
-        sessionContext.getVersionManager().doneMerge(getPath(), version);
+        sessionDelegate.getVersionManager().doneMerge(getPath(), version);
     }
 
     /**
@@ -778,7 +778,7 @@ public class NodeImpl extends ItemImpl i
      */
     @Override
     public void cancelMerge(Version version) throws RepositoryException {
-        sessionContext.getVersionManager().cancelMerge(getPath(), version);
+        sessionDelegate.getVersionManager().cancelMerge(getPath(), version);
     }
 
     /**
@@ -786,7 +786,7 @@ public class NodeImpl extends ItemImpl i
      */
     @Override
     public NodeIterator merge(String srcWorkspace, boolean bestEffort) throws RepositoryException {
-        return sessionContext.getVersionManager().merge(getPath(), srcWorkspace, bestEffort);
+        return sessionDelegate.getVersionManager().merge(getPath(), srcWorkspace, bestEffort);
     }
 
     /**
@@ -794,7 +794,7 @@ public class NodeImpl extends ItemImpl i
      */
     @Override
     public boolean isCheckedOut() throws RepositoryException {
-        return sessionContext.getVersionManager().isCheckedOut(getPath());
+        return sessionDelegate.getVersionManager().isCheckedOut(getPath());
     }
 
     /**
@@ -802,7 +802,7 @@ public class NodeImpl extends ItemImpl i
      */
     @Override
     public void restore(String versionName, boolean removeExisting) throws RepositoryException {
-        sessionContext.getVersionManager().restore(getPath(), versionName, removeExisting);
+        sessionDelegate.getVersionManager().restore(getPath(), versionName, removeExisting);
     }
 
     /**
@@ -810,7 +810,7 @@ public class NodeImpl extends ItemImpl i
      */
     @Override
     public void restore(Version version, boolean removeExisting) throws RepositoryException {
-        sessionContext.getVersionManager().restore(version, removeExisting);
+        sessionDelegate.getVersionManager().restore(version, removeExisting);
     }
 
     /**
@@ -832,7 +832,7 @@ public class NodeImpl extends ItemImpl i
      */
     @Override
     public void restoreByLabel(String versionLabel, boolean removeExisting) throws RepositoryException {
-        sessionContext.getVersionManager().restoreByLabel(getPath(), versionLabel, removeExisting);
+        sessionDelegate.getVersionManager().restoreByLabel(getPath(), versionLabel, removeExisting);
     }
 
     /**
@@ -840,7 +840,7 @@ public class NodeImpl extends ItemImpl i
      */
     @Override
     public VersionHistory getVersionHistory() throws RepositoryException {
-        return sessionContext.getVersionManager().getVersionHistory(getPath());
+        return sessionDelegate.getVersionManager().getVersionHistory(getPath());
     }
 
     /**
@@ -848,7 +848,7 @@ public class NodeImpl extends ItemImpl i
      */
     @Override
     public Version getBaseVersion() throws RepositoryException {
-        return sessionContext.getVersionManager().getBaseVersion(getPath());
+        return sessionDelegate.getVersionManager().getBaseVersion(getPath());
     }
 
     /**
@@ -856,7 +856,7 @@ public class NodeImpl extends ItemImpl i
      */
     @Override
     public Lock lock(boolean isDeep, boolean isSessionScoped) throws RepositoryException {
-        return sessionContext.getLockManager().lock(getPath(), isDeep, isSessionScoped, Long.MAX_VALUE, null);
+        return sessionDelegate.getLockManager().lock(getPath(), isDeep, isSessionScoped, Long.MAX_VALUE, null);
     }
 
     /**
@@ -864,7 +864,7 @@ public class NodeImpl extends ItemImpl i
      */
     @Override
     public Lock getLock() throws RepositoryException {
-        return sessionContext.getLockManager().getLock(getPath());
+        return sessionDelegate.getLockManager().getLock(getPath());
     }
 
     /**
@@ -872,7 +872,7 @@ public class NodeImpl extends ItemImpl i
      */
     @Override
     public void unlock() throws RepositoryException {
-        sessionContext.getLockManager().unlock(getPath());
+        sessionDelegate.getLockManager().unlock(getPath());
     }
 
     /**
@@ -880,7 +880,7 @@ public class NodeImpl extends ItemImpl i
      */
     @Override
     public boolean holdsLock() throws RepositoryException {
-        return sessionContext.getLockManager().holdsLock(getPath());
+        return sessionDelegate.getLockManager().holdsLock(getPath());
     }
 
     /**
@@ -888,7 +888,7 @@ public class NodeImpl extends ItemImpl i
      */
     @Override
     public boolean isLocked() throws RepositoryException {
-        return sessionContext.getLockManager().isLocked(getPath());
+        return sessionDelegate.getLockManager().isLocked(getPath());
     }
 
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java?rev=1333607&r1=1333606&r2=1333607&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java Thu May  3 20:29:48 2012
@@ -29,13 +29,13 @@ import java.util.List;
 
 public class PropertyDelegate extends ItemDelegate {
 
-    private final SessionContext sessionContext;
+    private final SessionDelegate sessionDelegate;
     private Tree parent;
     private PropertyState propertyState;
 
-    PropertyDelegate(SessionContext sessionContext, Tree parent,
+    PropertyDelegate(SessionDelegate sessionDelegate, Tree parent,
             PropertyState propertyState) {
-        this.sessionContext = sessionContext;
+        this.sessionDelegate = sessionDelegate;
         this.parent = parent;
         this.propertyState = propertyState;
     }
@@ -160,14 +160,14 @@ public class PropertyDelegate extends It
         return parentPath.isEmpty() ? '/' + getName() : '/' + parentPath + '/' + getName();
     }
 
-    SessionContext getSessionContext() {
-        return sessionContext;
+    SessionDelegate getSessionDelegate() {
+        return sessionDelegate;
     }
 
     //------------------------------------------------------------< private >---
 
     private synchronized void resolve() {
-        parent = sessionContext.getTree(parent.getPath());
+        parent = sessionDelegate.getTree(parent.getPath());
         String path = PathUtils.concat(parent.getPath(), propertyState.getName());
 
         if (parent == null) {

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=1333607&r1=1333606&r2=1333607&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 Thu May  3 20:29:48 2012
@@ -55,7 +55,7 @@ public class PropertyImpl extends ItemIm
     private final PropertyDelegate dlg;
     
     PropertyImpl(PropertyDelegate dlg) {
-        super(dlg.getSessionContext(), dlg);
+        super(dlg.getSessionDelegate(), dlg);
         this.dlg = dlg;
     }
 
@@ -73,7 +73,7 @@ public class PropertyImpl extends ItemIm
      */
     @Override
     public Node getParent() throws RepositoryException {
-        return new NodeImpl(new NodeDelegate(sessionContext,
+        return new NodeImpl(new NodeDelegate(sessionDelegate,
                 dlg.getParentTree()));
     }
 
@@ -320,7 +320,7 @@ public class PropertyImpl extends ItemIm
             throw new ValueFormatException(LogUtil.safeGetJCRPath(this) + " is multi-valued.");
         }
 
-        return ValueConverter.toValue(getPropertyState().getValue(), sessionContext);
+        return ValueConverter.toValue(getPropertyState().getValue(), sessionDelegate);
     }
 
     @Override
@@ -330,7 +330,7 @@ public class PropertyImpl extends ItemIm
             throw new ValueFormatException(LogUtil.safeGetJCRPath(this) + " is not multi-valued.");
         }
 
-        return ValueConverter.toValues(getPropertyState().getValues(), sessionContext);
+        return ValueConverter.toValues(getPropertyState().getValues(), sessionDelegate);
     }
 
     /**
@@ -561,8 +561,8 @@ public class PropertyImpl extends ItemIm
        if (value == null) {
            dlg.remove();
        } else {
-           Value targetValue = ValueHelper.convert(value, requiredType, sessionContext.getValueFactory());
-           dlg.setValue(ValueConverter.toCoreValue(targetValue, sessionContext));
+           Value targetValue = ValueHelper.convert(value, requiredType, sessionDelegate.getValueFactory());
+           dlg.setValue(ValueConverter.toCoreValue(targetValue, sessionDelegate));
        }
    }
 
@@ -582,8 +582,8 @@ public class PropertyImpl extends ItemIm
       if (values == null) {
           remove();
       } else {
-          Value[] targetValues = ValueHelper.convert(values, requiredType, sessionContext.getValueFactory());
-          dlg.setValues(ValueConverter.toCoreValues(targetValues, sessionContext));
+          Value[] targetValues = ValueHelper.convert(values, requiredType, sessionDelegate.getValueFactory());
+          dlg.setValues(ValueConverter.toCoreValues(targetValues, sessionDelegate));
       }
   }
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java?rev=1333607&r1=1333606&r2=1333607&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java Thu May  3 20:29:48 2012
@@ -51,7 +51,7 @@ public class RepositoryImpl implements R
      * Utility constructor that creates a new in-memory repository for use
      * mostly in test cases.
      */
-    public RepositoryImpl() throws RepositoryException {
+    public RepositoryImpl() {
         this(new ContentRepositoryImpl());
     }
 
@@ -122,7 +122,7 @@ public class RepositoryImpl implements R
         ContentRepository contentRepository = context.getInstance(ContentRepository.class);
         try {
             ContentSession contentSession = contentRepository.login(credentials, workspaceName);
-            return new SessionImpl(context, contentSession);
+            return new SessionDelegate(context, contentSession).getSession();
         } catch (LoginException e) {
             throw new javax.jcr.LoginException(e.getMessage());
         }

Added: 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=1333607&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java (added)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java Thu May  3 20:29:48 2012
@@ -0,0 +1,233 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.jcr;
+
+import org.apache.jackrabbit.oak.api.AuthInfo;
+import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.api.ContentSession;
+import org.apache.jackrabbit.oak.api.QueryEngine;
+import org.apache.jackrabbit.oak.api.Root;
+import org.apache.jackrabbit.oak.api.Tree;
+import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.jcr.namespace.NamespaceRegistryImpl;
+import org.apache.jackrabbit.oak.jcr.value.ValueFactoryImpl;
+import org.apache.jackrabbit.oak.namepath.AbstractNameMapper;
+import org.apache.jackrabbit.oak.namepath.NameMapper;
+import org.apache.jackrabbit.oak.namepath.NamePathMapper;
+import org.apache.jackrabbit.oak.namepath.NamePathMapperImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jcr.NamespaceRegistry;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.Workspace;
+import javax.jcr.lock.LockManager;
+import javax.jcr.nodetype.NodeTypeManager;
+import javax.jcr.version.VersionManager;
+import java.io.IOException;
+
+public class SessionDelegate {
+    static final Logger log = LoggerFactory.getLogger(SessionDelegate.class);
+
+    private final NameMapper nameMapper = new SessionNameMapper();
+    private final NamePathMapper namePathMapper = new NamePathMapperImpl(nameMapper);
+    private final GlobalContext context;
+    private final ContentSession contentSession;
+    private final ValueFactoryImpl valueFactory;
+    private final NamespaceRegistry nsRegistry;
+    private final Workspace workspace;
+    private final Session session;
+
+    private boolean isAlive = true;
+    private Root root;
+
+    public SessionDelegate(GlobalContext context, ContentSession contentSession)
+            throws RepositoryException {
+
+        this.context = context;
+        this.contentSession = contentSession;
+        this.valueFactory = new ValueFactoryImpl(contentSession.getCoreValueFactory(), namePathMapper);
+        this.nsRegistry = new NamespaceRegistryImpl(contentSession);
+        this.workspace = new WorkspaceImpl(this, this.nsRegistry);
+        this.root = contentSession.getCurrentRoot();
+        this.session = new SessionImpl(this);
+    }
+
+    public Repository getRepository() {
+        return context.getInstance(Repository.class);
+    }
+
+    public AuthInfo getAuthInfo() {
+        return contentSession.getAuthInfo();
+    }
+
+    public ValueFactoryImpl getValueFactory() {
+        return valueFactory;
+    }
+
+    public Tree getTree(String path) {
+        return root.getTree(path);
+    }
+
+    public NamePathMapper getNamePathMapper() {
+        return namePathMapper;
+    }
+
+    public void move(String srcAbsPath, String destAbsPath, boolean transientOp)
+            throws RepositoryException {
+
+        String srcPath = PathUtils.relativize("/", srcAbsPath);  // TODO: is this needed?
+        String destPath = PathUtils.relativize("/", destAbsPath);
+
+        try {
+            if (transientOp) {
+                root.move(srcPath, destPath);
+            }
+            else {
+                Root currentRoot = contentSession.getCurrentRoot();
+                currentRoot.move(srcPath, destPath);
+                currentRoot.commit();
+            }
+        }
+        catch (CommitFailedException e) {
+            throw new RepositoryException(e);
+        }
+    }
+
+    public void copy(String srcAbsPath, String destAbsPath) throws RepositoryException {
+        try {
+            Root currentRoot = contentSession.getCurrentRoot();
+            String srcPath = PathUtils.relativize("/", srcAbsPath);
+            String destPath = PathUtils.relativize("/", destAbsPath);
+            currentRoot.copy(srcPath, destPath);
+            currentRoot.commit();
+        }
+        catch (CommitFailedException e) {
+            throw new RepositoryException(e);
+        }
+    }
+
+    public void save() throws RepositoryException {
+        try {
+            root.commit();
+            root = contentSession.getCurrentRoot();
+        } catch (CommitFailedException e) {
+            throw new RepositoryException(e);
+        }
+    }
+
+    public void refresh(boolean keepChanges) {
+        if (keepChanges) {
+            root.rebase();
+        }
+        else {
+            root = contentSession.getCurrentRoot();
+        }
+    }
+
+    public boolean hasPendingChanges() {
+        return root.hasPendingChanges();
+    }
+
+    public boolean isAlive() {
+        return isAlive;
+    }
+
+    public void logout() {
+        if (!isAlive) {
+            // ignore
+            return;
+        }
+
+        isAlive = false;
+        // TODO
+
+        try {
+            contentSession.close();
+        } catch (IOException e) {
+            log.warn("Error while closing connection", e);
+        }
+    }
+
+    public Workspace getWorkspace() {
+        return workspace;
+    }
+
+    public Session getSession() {
+        return session;
+    }
+
+    public String getWorkspaceName() {
+        return contentSession.getWorkspaceName();
+    }
+
+    public QueryEngine getQueryEngine() {
+        return contentSession.getQueryEngine();
+    }
+
+    public NodeTypeManager getNodeTypeManager() throws RepositoryException {
+        return workspace.getNodeTypeManager();
+    }
+
+    public VersionManager getVersionManager() throws RepositoryException {
+        return workspace.getVersionManager();
+    }
+
+    public LockManager getLockManager() throws RepositoryException {
+        return workspace.getLockManager();
+    }
+
+    //-------------------------------------------< SessionNamespaceResolver >---
+
+    private class SessionNameMapper extends AbstractNameMapper {
+
+        @Override
+        protected String getJcrPrefix(String oakPrefix) {
+            try {
+                String ns = nsRegistry.getURI(oakPrefix);
+                return getSession().getNamespacePrefix(ns);
+            } catch (RepositoryException e) {
+                // TODO
+                return null;
+            }
+        }
+
+        @Override
+        protected String getOakPrefix(String jcrPrefix) {
+            try {
+                String ns = getSession().getNamespaceURI(jcrPrefix);
+                return nsRegistry.getPrefix(ns);
+            } catch (RepositoryException e) {
+                // TODO
+                return null;
+            }
+        }
+
+        @Override
+        protected String getOakPrefixFromURI(String uri) {
+            try {
+                return nsRegistry.getPrefix(uri);
+            } catch (RepositoryException e) {
+                // TODO
+                return null;
+            }
+        }
+    }
+
+}

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=1333607&r1=1333606&r2=1333607&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 Thu May  3 20:29:48 2012
@@ -20,24 +20,12 @@ import org.apache.jackrabbit.api.Jackrab
 import org.apache.jackrabbit.api.security.principal.PrincipalManager;
 import org.apache.jackrabbit.api.security.user.UserManager;
 import org.apache.jackrabbit.commons.AbstractSession;
-import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.api.ContentSession;
-import org.apache.jackrabbit.oak.api.Root;
-import org.apache.jackrabbit.oak.api.Tree;
-import org.apache.jackrabbit.oak.commons.PathUtils;
-import org.apache.jackrabbit.oak.jcr.namespace.NamespaceRegistryImpl;
-import org.apache.jackrabbit.oak.jcr.value.ValueFactoryImpl;
-import org.apache.jackrabbit.oak.namepath.AbstractNameMapper;
-import org.apache.jackrabbit.oak.namepath.NameMapper;
-import org.apache.jackrabbit.oak.namepath.NamePathMapper;
-import org.apache.jackrabbit.oak.namepath.NamePathMapperImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.ContentHandler;
 
 import javax.jcr.Credentials;
 import javax.jcr.InvalidItemStateException;
-import javax.jcr.NamespaceRegistry;
 import javax.jcr.Node;
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
@@ -45,12 +33,8 @@ import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.ValueFactory;
 import javax.jcr.Workspace;
-import javax.jcr.lock.LockManager;
-import javax.jcr.nodetype.NodeTypeManager;
 import javax.jcr.retention.RetentionManager;
 import javax.jcr.security.AccessControlManager;
-import javax.jcr.version.VersionManager;
-import java.io.IOException;
 import java.security.AccessControlException;
 
 /**
@@ -63,54 +47,37 @@ public class SessionImpl extends Abstrac
      */
     private static final Logger log = LoggerFactory.getLogger(SessionImpl.class);
 
-    private final GlobalContext globalContext;
-    private final ContentSession contentSession;
-    private final ValueFactoryImpl valueFactory;
-    private final Workspace workspace;
-    private final NamespaceRegistry nsreg;
-    private final SessionContext sessionContext = new Context();
-    private final NameMapper nameMapper = new SessionNameMapper();
-    private final NamePathMapper namePathMapper = new NamePathMapperImpl(nameMapper);
-
-    private boolean isAlive = true;
-    private Root root;
-
-    SessionImpl(GlobalContext globalContext, ContentSession contentSession)
-            throws RepositoryException {
-        this.globalContext = globalContext;
-        this.contentSession = contentSession;
-        this.valueFactory = new ValueFactoryImpl(contentSession.getCoreValueFactory(), namePathMapper);
-        this.nsreg = new NamespaceRegistryImpl(contentSession);
-        this.workspace = new WorkspaceImpl(sessionContext, this.nsreg);
-        this.root = contentSession.getCurrentRoot();
-    }
+    private final SessionDelegate dlg;
 
+    SessionImpl(SessionDelegate dlg) {
+        this.dlg = dlg;
+    }
 
     //------------------------------------------------------------< Session >---
 
     @Override
     public Repository getRepository() {
-        return globalContext.getInstance(Repository.class);
+        return dlg.getRepository();
     }
 
     @Override
     public String getUserID() {
-        return contentSession.getAuthInfo().getUserID();
+        return dlg.getAuthInfo().getUserID();
     }
 
     @Override
     public String[] getAttributeNames() {
-        return contentSession.getAuthInfo().getAttributeNames();
+        return dlg.getAuthInfo().getAttributeNames();
     }
 
     @Override
     public Object getAttribute(String name) {
-        return contentSession.getAuthInfo().getAttribute(name);
+        return dlg.getAuthInfo().getAttribute(name);
     }
 
     @Override
     public Workspace getWorkspace() {
-        return workspace;
+        return dlg.getWorkspace();
     }
 
     /**
@@ -125,7 +92,7 @@ public class SessionImpl extends Abstrac
     @Override
     public ValueFactory getValueFactory() throws RepositoryException {
         ensureIsAlive();
-        return sessionContext.getValueFactory();
+        return dlg.getValueFactory();
     }
 
     //------------------------------------------------------------< Reading >---
@@ -133,7 +100,7 @@ public class SessionImpl extends Abstrac
     @Override
     public Node getRootNode() throws RepositoryException {
         ensureIsAlive();
-        return new NodeImpl(new NodeDelegate(sessionContext, root.getTree("/")));
+        return new NodeImpl(new NodeDelegate(dlg, dlg.getTree("/")));
     }
 
     @Override
@@ -158,15 +125,8 @@ public class SessionImpl extends Abstrac
 
     @Override
     public void move(String srcAbsPath, String destAbsPath) throws RepositoryException {
-        internalMove(sessionContext.getNamePathMapper().toOakPath(srcAbsPath), sessionContext.getNamePathMapper().toOakPath(destAbsPath));
-    }
-
-    private void internalMove(String srcAbsPath, String destAbsPath) throws RepositoryException {
         ensureIsAlive();
-
-        String srcPath = PathUtils.relativize("/", srcAbsPath);
-        String destPath = PathUtils.relativize("/", destAbsPath);
-        root.move(srcPath, destPath);
+        dlg.move(dlg.getNamePathMapper().toOakPath(srcAbsPath), dlg.getNamePathMapper().toOakPath(destAbsPath), true);
     }
 
     //------------------------------------------------------------< state >---
@@ -174,62 +134,39 @@ public class SessionImpl extends Abstrac
     @Override
     public void save() throws RepositoryException {
         ensureIsAlive();
-        try {
-            root.commit();
-            root = contentSession.getCurrentRoot();
-        } catch (CommitFailedException e) {
-            throw new RepositoryException(e);
-        }
+        dlg.save();
     }
 
     @Override
     public void refresh(boolean keepChanges) throws RepositoryException {
         ensureIsAlive();
-        if (keepChanges) {
-            root.rebase();
-        }
-        else {
-            root = contentSession.getCurrentRoot();
-        }
+        dlg.refresh(keepChanges);
     }
 
     @Override
     public boolean hasPendingChanges() throws RepositoryException {
         ensureIsAlive();
-
-        return root.hasPendingChanges();
+        return dlg.hasPendingChanges();
     }
 
     //----------------------------------------------------------< Lifecycle >---
 
     @Override
     public boolean isLive() {
-        return isAlive;
+        return dlg.isAlive();
     }
 
 
     @Override
     public void logout() {
-        if (!isAlive) {
-            // ignore
-            return;
-        }
-
-        isAlive = false;
-        // TODO
-
-        try {
-            contentSession.close();
-        } catch (IOException e) {
-            log.warn("Error while closing connection", e);
-        }
+        dlg.logout();
     }
 
     //----------------------------------------------------< Import / Export >---
 
     @Override
     public ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior) throws RepositoryException {
-        return internalGetImportContentHandler(sessionContext.getNamePathMapper().toOakPath(parentAbsPath), uuidBehavior);
+        return internalGetImportContentHandler(dlg.getNamePathMapper().toOakPath(parentAbsPath), uuidBehavior);
     }
 
     private ContentHandler internalGetImportContentHandler(String parentAbsPath, int uuidBehavior) throws RepositoryException {
@@ -279,7 +216,7 @@ public class SessionImpl extends Abstrac
 
     @Override
     public boolean hasPermission(String absPath, String actions) throws RepositoryException {
-        return internalHasPermission(sessionContext.getNamePathMapper().toOakPath(absPath), actions);
+        return internalHasPermission(dlg.getNamePathMapper().toOakPath(absPath), actions);
     }
 
     private boolean internalHasPermission(String absPath, String actions) throws RepositoryException {
@@ -334,43 +271,6 @@ public class SessionImpl extends Abstrac
         throw new UnsupportedOperationException("Implementation missing");
     }
 
-    //-------------------------------------------< SessionNamespaceResolver >---
-    
-    private class SessionNameMapper extends AbstractNameMapper {
-
-        @Override
-        protected String getJcrPrefix(String oakPrefix) {
-            try {
-                String ns = nsreg.getURI(oakPrefix);
-                return getNamespacePrefix(ns);
-            } catch (RepositoryException e) {
-                // TODO
-                return null;
-            }
-        }
-
-        @Override
-        protected String getOakPrefix(String jcrPrefix) {
-            try {
-                String ns = getNamespaceURI(jcrPrefix);
-                return nsreg.getPrefix(ns);
-            } catch (RepositoryException e) {
-                // TODO
-                return null;
-            }
-        }
-
-        @Override
-        protected String getOakPrefixFromURI(String uri) {
-            try {
-                return nsreg.getPrefix(uri);
-            } catch (RepositoryException e) {
-                // TODO
-                return null;
-            }
-        }
-    }
-
     //--------------------------------------------------------------------------
 
     /**
@@ -381,7 +281,7 @@ public class SessionImpl extends Abstrac
      */
     void ensureIsAlive() throws RepositoryException {
         // check session status
-        if (!isAlive) {
+        if (!dlg.isAlive()) {
             throw new RepositoryException("This session has been closed.");
         }
     }
@@ -486,63 +386,4 @@ public class SessionImpl extends Abstrac
         }
     }
 
-    //--------------------------------------------------------------------------
-
-    private class Context implements SessionContext {
-
-        @Override
-        public SessionImpl getSession() {
-            return SessionImpl.this;
-        }
-
-        @Override
-        public GlobalContext getGlobalContext() {
-            return globalContext;
-        }
-
-        @Override
-        public String getWorkspaceName() {
-            return contentSession.getWorkspaceName();
-        }
-
-        @Override
-        public ContentSession getContentSession() {
-            return contentSession;
-        }
-
-        @Override
-        public ValueFactoryImpl getValueFactory() {
-            return valueFactory;
-        }
-
-        @Override
-        public LockManager getLockManager() throws RepositoryException {
-            return getWorkspace().getLockManager();
-        }
-
-        @Override
-        public VersionManager getVersionManager() throws RepositoryException {
-            return getWorkspace().getVersionManager();
-        }
-
-        @Override
-        public Root getRoot() {
-            return root;
-        }
-
-        @Override
-        public Tree getTree(String oakPath) {
-            return root.getTree(oakPath);
-        }
-
-        @Override
-        public NamePathMapper getNamePathMapper() {
-            return namePathMapper;
-        }
-
-        @Override
-        public NodeTypeManager getNodeTypeManager() throws RepositoryException {
-            return getWorkspace().getNodeTypeManager();
-        }
-    }
 }
\ No newline at end of file

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=1333607&r1=1333606&r2=1333607&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 Thu May  3 20:29:48 2012
@@ -18,10 +18,6 @@ package org.apache.jackrabbit.oak.jcr;
 
 import org.apache.jackrabbit.api.JackrabbitWorkspace;
 import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
-import org.apache.jackrabbit.oak.api.Root;
-import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.api.ContentSession;
-import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.jcr.nodetype.NodeTypeManagerImpl;
 import org.apache.jackrabbit.oak.jcr.query.QueryManagerImpl;
 import org.apache.jackrabbit.oak.jcr.security.privileges.PrivilegeManagerImpl;
@@ -54,7 +50,7 @@ public class WorkspaceImpl implements Ja
      */
     private static final Logger log = LoggerFactory.getLogger(WorkspaceImpl.class);
 
-    private final SessionContext sessionContext;
+    private final SessionDelegate sessionDelegate;
 
     private QueryManagerImpl queryManager;
 
@@ -62,23 +58,23 @@ public class WorkspaceImpl implements Ja
 
     private final NodeTypeManager nodeTypeManager;
 
-    public WorkspaceImpl(SessionContext sessionContext, NamespaceRegistry nsRegistry)
+    public WorkspaceImpl(SessionDelegate sessionDelegate, NamespaceRegistry nsRegistry)
             throws RepositoryException {
 
-        this.sessionContext = sessionContext;
+        this.sessionDelegate = sessionDelegate;
         this.nsRegistry = nsRegistry;
-        this.nodeTypeManager = new NodeTypeManagerImpl(sessionContext.getNamePathMapper());
+        this.nodeTypeManager = new NodeTypeManagerImpl(sessionDelegate.getNamePathMapper());
     }
 
     //----------------------------------------------------------< Workspace >---
     @Override
     public Session getSession() {
-        return sessionContext.getSession();
+        return sessionDelegate.getSession();
     }
 
     @Override
     public String getName() {
-        return sessionContext.getWorkspaceName();
+        return sessionDelegate.getWorkspaceName();
     }
 
     @Override
@@ -96,19 +92,8 @@ public class WorkspaceImpl implements Ja
             throw new UnsupportedRepositoryOperationException("Not implemented.");
         }
 
-        try {
-            ContentSession contentSession = sessionContext.getContentSession();
-            Root root = contentSession.getCurrentRoot();
-
-            String srcPath = PathUtils.relativize("/", srcAbsPath);
-            String destPath = PathUtils.relativize("/", destAbsPath);
-            root.copy(srcPath, destPath);
-
-            root.commit();
-        }
-        catch (CommitFailedException e) {
-            throw new RepositoryException(e);
-        }
+        // FIXME: convert to oak paths
+        sessionDelegate.copy(srcAbsPath, destAbsPath);
     }
 
     @SuppressWarnings("deprecation")
@@ -118,7 +103,6 @@ public class WorkspaceImpl implements Ja
         ensureIsAlive();
 
         // TODO -> SPI
-
     }
 
     @SuppressWarnings("deprecation")
@@ -127,19 +111,7 @@ public class WorkspaceImpl implements Ja
         ensureSupportedOption(Repository.LEVEL_2_SUPPORTED);
         ensureIsAlive();
 
-        try {
-            ContentSession contentSession = sessionContext.getContentSession();
-            Root root = contentSession.getCurrentRoot();
-
-            String srcPath = PathUtils.relativize("/", srcAbsPath);
-            String destPath = PathUtils.relativize("/", destAbsPath);
-            root.move(srcPath, destPath);
-
-            root.commit();
-        }
-        catch (CommitFailedException e) {
-            throw new RepositoryException(e);
-        }
+        sessionDelegate.move(srcAbsPath, destAbsPath, false);
     }
 
     @Override
@@ -158,7 +130,7 @@ public class WorkspaceImpl implements Ja
     public QueryManager getQueryManager() throws RepositoryException {
         ensureIsAlive();
         if (queryManager == null) {
-            queryManager = new QueryManagerImpl(this, sessionContext);
+            queryManager = new QueryManagerImpl(this, sessionDelegate);
         }
         return queryManager;
     }
@@ -251,18 +223,102 @@ public class WorkspaceImpl implements Ja
      */
     @Override
     public PrivilegeManager getPrivilegeManager() throws RepositoryException {
-        return new PrivilegeManagerImpl(sessionContext);
+        return new PrivilegeManagerImpl(sessionDelegate);
     }
 
 
     //------------------------------------------------------------< private >---
 
     private void ensureIsAlive() throws RepositoryException {
-        sessionContext.getSession().ensureIsAlive();
+        // check session status
+        if (!sessionDelegate.isAlive()) {
+            throw new RepositoryException("This session has been closed.");
+        }
     }
 
+    /**
+     * Returns true if the repository supports the given option. False otherwise.
+     *
+     * @param option Any of the option constants defined by {@link Repository}
+     * that either returns 'true' or 'false'. I.e.
+     * <ul>
+     * <li>{@link Repository#LEVEL_1_SUPPORTED}</li>
+     * <li>{@link Repository#LEVEL_2_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_ACCESS_CONTROL_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_ACTIVITIES_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_BASELINES_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_JOURNALED_OBSERVATION_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_LIFECYCLE_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_LOCKING_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_NODE_TYPE_MANAGEMENT_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_OBSERVATION_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_QUERY_SQL_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_RETENTION_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_SHAREABLE_NODES_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_SIMPLE_VERSIONING_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_TRANSACTIONS_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_UNFILED_CONTENT_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_UPDATE_MIXIN_NODE_TYPES_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_UPDATE_PRIMARY_NODE_TYPE_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_VERSIONING_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_WORKSPACE_MANAGEMENT_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_XML_EXPORT_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_XML_IMPORT_SUPPORTED}</li>
+     * <li>{@link Repository#WRITE_SUPPORTED}</li>
+     * </ul>
+     * @return true if the repository supports the given option. False otherwise.
+     */
+    private boolean isSupportedOption(String option) {
+        String desc = sessionDelegate.getSession().getRepository().getDescriptor(option);
+        // if the descriptors are not available return true. the missing
+        // functionality of the given SPI impl will in this case be detected
+        // upon the corresponding SPI call (see JCR-3143).
+        return (desc == null) ? true : Boolean.valueOf(desc);
+    }
+
+    /**
+     * Make sure the repository supports the option indicated by the given string
+     * and throw an exception otherwise.
+     *
+     * @param option Any of the option constants defined by {@link Repository}
+     * that either returns 'true' or 'false'. I.e.
+     * <ul>
+     * <li>{@link Repository#LEVEL_1_SUPPORTED}</li>
+     * <li>{@link Repository#LEVEL_2_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_ACCESS_CONTROL_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_ACTIVITIES_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_BASELINES_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_JOURNALED_OBSERVATION_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_LIFECYCLE_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_LOCKING_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_NODE_TYPE_MANAGEMENT_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_OBSERVATION_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_QUERY_SQL_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_RETENTION_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_SHAREABLE_NODES_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_SIMPLE_VERSIONING_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_TRANSACTIONS_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_UNFILED_CONTENT_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_UPDATE_MIXIN_NODE_TYPES_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_UPDATE_PRIMARY_NODE_TYPE_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_VERSIONING_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_WORKSPACE_MANAGEMENT_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_XML_EXPORT_SUPPORTED}</li>
+     * <li>{@link Repository#OPTION_XML_IMPORT_SUPPORTED}</li>
+     * <li>{@link Repository#WRITE_SUPPORTED}</li>
+     * </ul>
+     * @throws UnsupportedRepositoryOperationException If the given option is
+     * not supported.
+     * @throws RepositoryException If another error occurs.
+     * @see javax.jcr.Repository#getDescriptorKeys()
+     */
     private void ensureSupportedOption(String option) throws RepositoryException {
-        sessionContext.getSession().ensureSupportsOption(option);
+        if (!isSupportedOption(option)) {
+            throw new UnsupportedRepositoryOperationException(option + " is not supported by this repository.");
+        }
     }
 
+
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryManagerImpl.java?rev=1333607&r1=1333606&r2=1333607&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryManagerImpl.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryManagerImpl.java Thu May  3 20:29:48 2012
@@ -21,7 +21,7 @@ package org.apache.jackrabbit.oak.jcr.qu
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.QueryEngine;
 import org.apache.jackrabbit.oak.api.Result;
-import org.apache.jackrabbit.oak.jcr.SessionContext;
+import org.apache.jackrabbit.oak.jcr.SessionDelegate;
 import org.apache.jackrabbit.oak.jcr.WorkspaceImpl;
 import org.apache.jackrabbit.oak.jcr.query.qom.QueryObjectModelFactoryImpl;
 
@@ -45,11 +45,11 @@ public class QueryManagerImpl implements
 
     private final QueryObjectModelFactoryImpl qomFactory = new QueryObjectModelFactoryImpl();
     private final QueryEngine queryEngine;
-    private final SessionContext sessionContext;
+    private final SessionDelegate sessionDelegate;
 
-    public QueryManagerImpl(WorkspaceImpl workspace, SessionContext sessionContext) {
-        queryEngine = sessionContext.getContentSession().getQueryEngine();
-        this.sessionContext = sessionContext;
+    public QueryManagerImpl(WorkspaceImpl workspace, SessionDelegate sessionDelegate) {
+        queryEngine = sessionDelegate.getQueryEngine();
+        this.sessionDelegate = sessionDelegate;
     }
 
     @Override
@@ -94,7 +94,7 @@ public class QueryManagerImpl implements
         try {
             HashMap<String, CoreValue> bindMap = convertMap(bindVariableMap);
             Result r = queryEngine.executeQuery(statement, language, bindMap);
-            return new QueryResultImpl(r, sessionContext.getValueFactory());
+            return new QueryResultImpl(r, sessionDelegate.getValueFactory());
         } catch (ParseException e) {
             throw new InvalidQueryException(e);
         }
@@ -104,7 +104,7 @@ public class QueryManagerImpl implements
 
         HashMap<String, CoreValue> map = new HashMap<String, CoreValue>();
         for (Entry<String, Value> e : bindVariableMap.entrySet()) {
-            map.put(e.getKey(), sessionContext.getValueFactory().getCoreValue(e.getValue()));
+            map.put(e.getKey(), sessionDelegate.getValueFactory().getCoreValue(e.getValue()));
         }
         return map;
     }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/privileges/PrivilegeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/privileges/PrivilegeManagerImpl.java?rev=1333607&r1=1333606&r2=1333607&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/privileges/PrivilegeManagerImpl.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/privileges/PrivilegeManagerImpl.java Thu May  3 20:29:48 2012
@@ -18,7 +18,7 @@ package org.apache.jackrabbit.oak.jcr.se
 
 import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
 import org.apache.jackrabbit.oak.jcr.NodeImpl;
-import org.apache.jackrabbit.oak.jcr.SessionContext;
+import org.apache.jackrabbit.oak.jcr.SessionDelegate;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -54,10 +54,10 @@ public class PrivilegeManagerImpl implem
     private static final String REP_IS_ABSTRACT = "rep:isAbstract";
     private static final String REP_CONTAINS = "rep:contains";
 
-    private final SessionContext sessionContext;
+    private final SessionDelegate sessionDelegate;
 
-    public PrivilegeManagerImpl(SessionContext sessionContext) {
-        this.sessionContext = sessionContext;
+    public PrivilegeManagerImpl(SessionDelegate sessionDelegate) {
+        this.sessionDelegate = sessionDelegate;
         // TODO: add additional validation ??
     }
 
@@ -96,7 +96,7 @@ public class PrivilegeManagerImpl implem
 
     //--------------------------------------------------------------------------
     private NodeImpl getPrivilegeRoot() throws RepositoryException {
-        return (NodeImpl) sessionContext.getSession().getNode(PRIVILEGE_ROOT);
+        return (NodeImpl) sessionDelegate.getSession().getNode(PRIVILEGE_ROOT);
     }
 
     private Privilege getPrivilege(Node privilegeNode, Map<String, Privilege> collected) throws RepositoryException {

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/AuthorizableNodeCreator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/AuthorizableNodeCreator.java?rev=1333607&r1=1333606&r2=1333607&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/AuthorizableNodeCreator.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/AuthorizableNodeCreator.java Thu May  3 20:29:48 2012
@@ -17,7 +17,7 @@
 package org.apache.jackrabbit.oak.jcr.security.user;
 
 import org.apache.jackrabbit.oak.jcr.NodeImpl;
-import org.apache.jackrabbit.oak.jcr.SessionContext;
+import org.apache.jackrabbit.oak.jcr.SessionDelegate;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -31,7 +31,7 @@ class AuthorizableNodeCreator {
      */
     private static final Logger log = LoggerFactory.getLogger(AuthorizableNodeCreator.class);
 
-    AuthorizableNodeCreator(SessionContext sessionContext) {
+    AuthorizableNodeCreator(SessionDelegate sessionDelegate) {
         // TODO
     }
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java?rev=1333607&r1=1333606&r2=1333607&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java Thu May  3 20:29:48 2012
@@ -24,7 +24,7 @@ import org.apache.jackrabbit.api.securit
 import org.apache.jackrabbit.api.security.user.UserManager;
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.jcr.NodeImpl;
-import org.apache.jackrabbit.oak.jcr.SessionContext;
+import org.apache.jackrabbit.oak.jcr.SessionDelegate;
 import org.apache.jackrabbit.oak.jcr.security.user.action.AuthorizableAction;
 import org.apache.jackrabbit.oak.jcr.value.ValueConverter;
 import org.slf4j.Logger;
@@ -51,14 +51,14 @@ public class UserManagerImpl implements 
      */
     private static final Logger log = LoggerFactory.getLogger(UserManagerImpl.class);
 
-    private final SessionContext sessionContext;
+    private final SessionDelegate sessionDelegate;
     private final UserManagerConfig config;
     private final AuthorizableNodeCreator nodeCreator;
 
-    public UserManagerImpl(SessionContext sessionContext, UserManagerConfig config) {
-        this.sessionContext = sessionContext;
+    public UserManagerImpl(SessionDelegate sessionDelegate, UserManagerConfig config) {
+        this.sessionDelegate = sessionDelegate;
         this.config = config;
-        nodeCreator = new AuthorizableNodeCreator(sessionContext);
+        nodeCreator = new AuthorizableNodeCreator(sessionDelegate);
     }
 
     //--------------------------------------------------------< UserManager >---
@@ -69,7 +69,7 @@ public class UserManagerImpl implements 
     public Authorizable getAuthorizable(String id) throws RepositoryException {
         Authorizable authorizable = null;
         try {
-            NodeImpl node = (NodeImpl) sessionContext.getSession().getNodeByIdentifier(buildIdentifier(id));
+            NodeImpl node = (NodeImpl) sessionDelegate.getSession().getNodeByIdentifier(buildIdentifier(id));
             authorizable = getAuthorizable(node);
         } catch (ItemNotFoundException e) {
             log.debug("No authorizable with ID " + id);
@@ -82,7 +82,7 @@ public class UserManagerImpl implements 
      */
     @Override
     public Authorizable getAuthorizable(Principal principal) throws RepositoryException {
-        Session session = sessionContext.getSession();
+        Session session = sessionDelegate.getSession();
         Authorizable authorizable = null;
         if (principal instanceof ItemBasedPrincipal) {
             String authPath = ((ItemBasedPrincipal) principal).getPath();
@@ -228,7 +228,7 @@ public class UserManagerImpl implements 
      */
     void onCreate(User user, String password) throws RepositoryException {
         for (AuthorizableAction action : config.getAuthorizableActions()) {
-            action.onCreate(user, password, sessionContext.getSession());
+            action.onCreate(user, password, sessionDelegate.getSession());
         }
     }
 
@@ -242,7 +242,7 @@ public class UserManagerImpl implements 
      */
     void onCreate(Group group) throws RepositoryException {
         for (AuthorizableAction action : config.getAuthorizableActions()) {
-            action.onCreate(group, sessionContext.getSession());
+            action.onCreate(group, sessionDelegate.getSession());
         }
     }
 
@@ -256,7 +256,7 @@ public class UserManagerImpl implements 
      */
     void onRemove(Authorizable authorizable) throws RepositoryException {
         for (AuthorizableAction action : config.getAuthorizableActions()) {
-            action.onRemove(authorizable, sessionContext.getSession());
+            action.onRemove(authorizable, sessionDelegate.getSession());
         }
     }
 
@@ -271,7 +271,7 @@ public class UserManagerImpl implements 
      */
     void onPasswordChange(User user, String password) throws RepositoryException {
         for (AuthorizableAction action : config.getAuthorizableActions()) {
-            action.onPasswordChange(user, password, sessionContext.getSession());
+            action.onPasswordChange(user, password, sessionDelegate.getSession());
         }
     }
 
@@ -326,17 +326,17 @@ public class UserManagerImpl implements 
     }
 
     void setInternalProperty(NodeImpl userNode, String name, String value, int type) throws RepositoryException {
-        CoreValue cv = ValueConverter.toCoreValue(value, type, sessionContext);
-        sessionContext.getTree(userNode.getOakPath()).setProperty(name, cv);
+        CoreValue cv = ValueConverter.toCoreValue(value, type, sessionDelegate);
+        sessionDelegate.getTree(userNode.getOakPath()).setProperty(name, cv);
     }
 
     void setInternalProperty(NodeImpl userNode, String name, String[] values, int type) throws RepositoryException {
-        List<CoreValue> cvs = ValueConverter.toCoreValues(values, type, sessionContext);
-        sessionContext.getTree(userNode.getOakPath()).setProperty(name, cvs);
+        List<CoreValue> cvs = ValueConverter.toCoreValues(values, type, sessionDelegate);
+        sessionDelegate.getTree(userNode.getOakPath()).setProperty(name, cvs);
     }
 
     void removeInternalProperty(NodeImpl userNode, String name) {
-        sessionContext.getTree(userNode.getOakPath()).removeProperty(name);
+        sessionDelegate.getTree(userNode.getOakPath()).removeProperty(name);
     }
 
     private Authorizable getAuthorizable(NodeImpl node) throws RepositoryException {

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueConverter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueConverter.java?rev=1333607&r1=1333606&r2=1333607&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueConverter.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueConverter.java Thu May  3 20:29:48 2012
@@ -20,7 +20,7 @@
 package org.apache.jackrabbit.oak.jcr.value;
 
 import org.apache.jackrabbit.oak.api.CoreValue;
-import org.apache.jackrabbit.oak.jcr.SessionContext;
+import org.apache.jackrabbit.oak.jcr.SessionDelegate;
 
 import javax.jcr.Value;
 import javax.jcr.ValueFormatException;
@@ -35,41 +35,41 @@ import java.util.List;
 public final class ValueConverter {
     private ValueConverter() {}
 
-    public static CoreValue toCoreValue(String value, int propertyType, SessionContext sessionContext) throws ValueFormatException {
-        return toCoreValue(sessionContext.getValueFactory().createValue(value, propertyType), sessionContext);
+    public static CoreValue toCoreValue(String value, int propertyType, SessionDelegate sessionDelegate) throws ValueFormatException {
+        return toCoreValue(sessionDelegate.getValueFactory().createValue(value, propertyType), sessionDelegate);
     }
 
-    public static CoreValue toCoreValue(Value value, SessionContext sessionContext) {
-        ValueFactoryImpl vf = sessionContext.getValueFactory();
+    public static CoreValue toCoreValue(Value value, SessionDelegate sessionDelegate) {
+        ValueFactoryImpl vf = sessionDelegate.getValueFactory();
         return vf.getCoreValue(value);
     }
 
-    public static List<CoreValue> toCoreValues(String[] values, int propertyType, SessionContext sessionContext) throws ValueFormatException {
+    public static List<CoreValue> toCoreValues(String[] values, int propertyType, SessionDelegate sessionDelegate) throws ValueFormatException {
         Value[] vs = new Value[values.length];
         for (int i = 0; i < values.length; i++) {
-            vs[i] = sessionContext.getValueFactory().createValue(values[i], propertyType);
+            vs[i] = sessionDelegate.getValueFactory().createValue(values[i], propertyType);
         }
-        return toCoreValues(vs, sessionContext);
+        return toCoreValues(vs, sessionDelegate);
     }
 
-    public static List<CoreValue> toCoreValues(Value[] values, SessionContext sessionContext) {
+    public static List<CoreValue> toCoreValues(Value[] values, SessionDelegate sessionDelegate) {
         List<CoreValue> cvs = new ArrayList<CoreValue>(values.length);
         for (Value jcrValue : values) {
             if (jcrValue != null) {
-                cvs.add(toCoreValue(jcrValue, sessionContext));
+                cvs.add(toCoreValue(jcrValue, sessionDelegate));
             }
         }
         return cvs;
     }
 
-    public static Value toValue(CoreValue coreValue, SessionContext sessionContext) {
-        return sessionContext.getValueFactory().createValue(coreValue);
+    public static Value toValue(CoreValue coreValue, SessionDelegate sessionDelegate) {
+        return sessionDelegate.getValueFactory().createValue(coreValue);
     }
 
-    public static Value[] toValues(Iterable<CoreValue> coreValues, SessionContext sessionContext) {
+    public static Value[] toValues(Iterable<CoreValue> coreValues, SessionDelegate sessionDelegate) {
         List<Value> values = new ArrayList<Value>();
         for (CoreValue cv : coreValues) {
-            values.add(toValue(cv, sessionContext));
+            values.add(toValue(cv, sessionDelegate));
         }
         return values.toArray(new Value[values.size()]);
     }

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/RepositoryServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/RepositoryServlet.java?rev=1333607&r1=1333606&r2=1333607&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/RepositoryServlet.java (original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/RepositoryServlet.java Thu May  3 20:29:48 2012
@@ -22,7 +22,6 @@ import org.apache.jackrabbit.oak.jcr.Rep
 import org.apache.jackrabbit.webdav.jcr.JCRWebdavServerServlet;
 
 import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
 import javax.servlet.ServletException;
 
 class RepositoryServlet extends JCRWebdavServerServlet {
@@ -45,12 +44,7 @@ class RepositoryServlet extends JCRWebda
             kernel = new MicroKernelImpl();
         }
 
-        try {
-            repository = new RepositoryImpl();
-        } catch (RepositoryException e) {
-            throw new ServletException("Could not start a repository", e);
-        }
-
+        repository = new RepositoryImpl();
         super.init();
     }
 



Mime
View raw message