jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r985244 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: ./ nodetype/ query/lucene/ session/ version/
Date Fri, 13 Aug 2010 15:30:47 GMT
Author: jukka
Date: Fri Aug 13 15:30:46 2010
New Revision: 985244

URL: http://svn.apache.org/viewvc?rev=985244&view=rev
Log:
JCR-890: concurrent read-only access to a session

Make NodeTypeManager a part of SessionContext.

Remove the session member variable from ItemImpl

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AddMixinOperation.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemSaveOperation.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ProtectedItemModifier.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RemoveMixinOperation.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryObjectModelImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionContext.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AddMixinOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AddMixinOperation.java?rev=985244&r1=985243&r2=985244&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AddMixinOperation.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AddMixinOperation.java Fri Aug 13 15:30:46 2010
@@ -72,8 +72,7 @@ class AddMixinOperation implements Sessi
                 CHECK_LOCK | CHECK_CHECKED_OUT | CHECK_CONSTRAINTS | CHECK_HOLD,
                 permissions);
 
-        NodeTypeManagerImpl ntMgr =
-            context.getSessionImpl().getNodeTypeManager();
+        NodeTypeManagerImpl ntMgr = context.getNodeTypeManager();
         NodeTypeImpl mixin = ntMgr.getNodeType(mixinName);
         if (!mixin.isMixin()) {
             throw new RepositoryException(
@@ -89,7 +88,7 @@ class AddMixinOperation implements Sessi
 
         // build effective node type of mixin's & primary type in order
         // to detect conflicts
-        NodeTypeRegistry ntReg = ntMgr.getNodeTypeRegistry();
+        NodeTypeRegistry ntReg = context.getNodeTypeRegistry();
         EffectiveNodeType entExisting;
         try {
             // existing mixin's

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java?rev=985244&r1=985243&r2=985244&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java Fri Aug 13 15:30:46 2010
@@ -56,11 +56,6 @@ public abstract class ItemImpl implement
     protected final SessionContext sessionContext;
 
     /**
-     * The session to which this item is associated.
-     */
-    protected final SessionImpl session;
-
-    /**
      * Item data associated with this item.
      */
     protected final ItemData data;
@@ -84,7 +79,6 @@ public abstract class ItemImpl implement
      */
     ItemImpl(ItemManager itemMgr, SessionContext sessionContext, ItemData data) {
         this.sessionContext = sessionContext;
-        this.session = sessionContext.getSessionImpl();
         this.stateMgr = sessionContext.getItemStateManager();
         this.id = data.getId();
         this.itemMgr = itemMgr;
@@ -411,7 +405,7 @@ public abstract class ItemImpl implement
      * @return current session
      */
     public Session getSession() {
-        return session;
+        return sessionContext.getSessionImpl();
     }
 
     /**
@@ -427,7 +421,7 @@ public abstract class ItemImpl implement
         if (otherItem instanceof ItemImpl) {
             ItemImpl other = (ItemImpl) otherItem;
             return id.equals(other.id)
-                    && session.getWorkspace().getName().equals(
+                    && getSession().getWorkspace().getName().equals(
                             other.getSession().getWorkspace().getName());
         }
         return false;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java?rev=985244&r1=985243&r2=985244&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java Fri Aug 13 15:30:46 2010
@@ -117,13 +117,12 @@ public class ItemManager implements Dump
      * @param sessionContext component context of the associated session
      * @param rootNodeDef the definition of the root node
      */
-    protected ItemManager(
-            SessionContext sessionContext, NodeDefinitionImpl rootNodeDef) {
+    protected ItemManager(SessionContext sessionContext) {
         this.sism = sessionContext.getItemStateManager();
         this.hierMgr = sessionContext.getHierarchyManager();
         this.sessionContext = sessionContext;
         this.session = sessionContext.getSessionImpl();
-        this.rootNodeDef = rootNodeDef;
+        this.rootNodeDef = sessionContext.getNodeTypeManager().getRootNodeDefinition();
 
         // setup item cache with weak references to items
         itemCache = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.WEAK);
@@ -200,7 +199,7 @@ public class ItemManager implements Dump
 
         // get child node entry
         ChildNodeEntry cne = parentState.getChildNodeEntry(state.getNodeId());
-        NodeTypeRegistry ntReg = session.getNodeTypeManager().getNodeTypeRegistry();
+        NodeTypeRegistry ntReg = sessionContext.getNodeTypeRegistry();
         try {
             EffectiveNodeType ent = ntReg.getEffectiveNodeType(
                     parentState.getNodeTypeName(), parentState.getMixinTypeNames());
@@ -216,7 +215,7 @@ public class ItemManager implements Dump
                 log.warn("Fallback to nt:unstructured due to unknown child " +
                         "node definition for type '" + state.getNodeTypeName() + "'");
             }
-            return session.getNodeTypeManager().getNodeDefinition(def);
+            return sessionContext.getNodeTypeManager().getNodeDefinition(def);
         } catch (NodeTypeConflictException e) {
             throw new RepositoryException(e);
         }
@@ -231,11 +230,11 @@ public class ItemManager implements Dump
         // see also: JCR-2408
         if (state.getStatus() == ItemState.STATUS_EXISTING_REMOVED
                 && state.getName().equals(NameConstants.JCR_UUID)) {
-            NodeTypeRegistry ntReg = session.getNodeTypeManager().getNodeTypeRegistry();
+            NodeTypeRegistry ntReg = sessionContext.getNodeTypeRegistry();
             QPropertyDefinition def = ntReg.getEffectiveNodeType(
                     NameConstants.MIX_REFERENCEABLE).getApplicablePropertyDef(
                     state.getName(), state.getType());
-            return session.getNodeTypeManager().getPropertyDefinition(def);
+            return sessionContext.getNodeTypeManager().getPropertyDefinition(def);
         }
         try {
             // retrieve parent in 2 steps in order to avoid the check for
@@ -251,7 +250,7 @@ public class ItemManager implements Dump
         try {
             NodeState parent = (NodeState) sism.getAttic().getItemState(
                     state.getParentId()).getOverlayedState();
-            NodeTypeRegistry ntReg = session.getNodeTypeManager().getNodeTypeRegistry();
+            NodeTypeRegistry ntReg = sessionContext.getNodeTypeRegistry();
             EffectiveNodeType ent = ntReg.getEffectiveNodeType(
                     parent.getNodeTypeName(), parent.getMixinTypeNames());
             QPropertyDefinition def;
@@ -265,7 +264,7 @@ public class ItemManager implements Dump
                 log.warn("Fallback to nt:unstructured due to unknown property " +
                         "definition for '" + state.getName() + "'");
             }
-            return session.getNodeTypeManager().getPropertyDefinition(def);
+            return sessionContext.getNodeTypeManager().getPropertyDefinition(def);
         } catch (ItemStateException e) {
             throw new RepositoryException(e);
         } catch (NodeTypeConflictException e) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemSaveOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemSaveOperation.java?rev=985244&r1=985243&r2=985244&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemSaveOperation.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemSaveOperation.java Fri Aug 13 15:30:46 2010
@@ -430,7 +430,7 @@ class ItemSaveOperation implements Sessi
         SessionItemStateManager stateMgr = context.getItemStateManager();
 
         AccessManager accessMgr = context.getAccessManager();
-        NodeTypeManagerImpl ntMgr = session.getNodeTypeManager();
+        NodeTypeManagerImpl ntMgr = context.getNodeTypeManager();
         // walk through list of dirty transient items and validate each
         for (ItemState itemState : dirty) {
             ItemDefinition def;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=985244&r1=985243&r2=985244&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java Fri Aug 13 15:30:46 2010
@@ -136,7 +136,7 @@ public class NodeImpl extends ItemImpl i
         super(itemMgr, sessionContext, data);
         this.data = data;
         // paranoid sanity check
-        NodeTypeRegistry ntReg = session.getNodeTypeManager().getNodeTypeRegistry();
+        NodeTypeRegistry ntReg = sessionContext.getNodeTypeRegistry();
         final NodeState state = data.getNodeState();
         if (!ntReg.isRegistered(state.getNodeTypeName())) {
             /**
@@ -223,11 +223,11 @@ public class NodeImpl extends ItemImpl i
      */
     private Path resolveRelativePath(String relPath) throws RepositoryException {
         try {
-            return session.getQPath(relPath);
+            return sessionContext.getQPath(relPath);
         } catch (NameException e) {
-            String msg = "failed to resolve path " + relPath + " relative to " + this;
-            log.debug(msg);
-            throw new RepositoryException(msg, e);
+            throw new RepositoryException(
+                    "Failed to resolve path " + relPath
+                    + " relative to " + this, e);
         }
     }
 
@@ -369,7 +369,7 @@ public class NodeImpl extends ItemImpl i
             throws ConstraintViolationException, RepositoryException {
         try {
             return getOrCreateProperty(
-                    session.getQName(name), type,
+                    sessionContext.getQName(name), type,
                     multiValued, exactTypeMatch, status);
         } catch (NameException e) {
             throw new RepositoryException("invalid property name: " + name, e);
@@ -471,8 +471,9 @@ public class NodeImpl extends ItemImpl i
             propState.setType(type);
             propState.setMultiValued(propDef.isMultiple());
             // compute system generated values if necessary
-            InternalValue[] genValues = session.getNodeTypeInstanceHandler()
-                    .computeSystemGeneratedPropertyValues(data.getNodeState(), propDef);
+            InternalValue[] genValues =
+                sessionContext.getSessionImpl().getNodeTypeInstanceHandler()
+                .computeSystemGeneratedPropertyValues(data.getNodeState(), propDef);
             if (genValues == null) {
                 genValues = InternalValue.create(propDef.getDefaultValues());
             }
@@ -634,7 +635,7 @@ public class NodeImpl extends ItemImpl i
 
     protected void onRedefine(QNodeDefinition def) throws RepositoryException {
         NodeDefinitionImpl newDef =
-                session.getNodeTypeManager().getNodeDefinition(def);
+            sessionContext.getNodeTypeManager().getNodeDefinition(def);
         // modify the state of 'this', i.e. the target node
         getOrCreateTransientItemState();
         // set new definition
@@ -742,9 +743,7 @@ public class NodeImpl extends ItemImpl i
      */
     public EffectiveNodeType getEffectiveNodeType() throws RepositoryException {
         try {
-            NodeTypeRegistry registry =
-                session.getNodeTypeManager().getNodeTypeRegistry();
-            return registry.getEffectiveNodeType(
+            return sessionContext.getNodeTypeRegistry().getEffectiveNodeType(
                     data.getNodeState().getNodeTypeName(),
                     data.getNodeState().getMixinTypeNames());
         } catch (NodeTypeConflictException ntce) {
@@ -768,9 +767,9 @@ public class NodeImpl extends ItemImpl i
     protected NodeDefinitionImpl getApplicableChildNodeDefinition(Name nodeName,
                                                                   Name nodeTypeName)
             throws ConstraintViolationException, RepositoryException {
-        NodeTypeManagerImpl ntMgr = session.getNodeTypeManager();
+        NodeTypeManagerImpl ntMgr = sessionContext.getNodeTypeManager();
         QNodeDefinition cnd = getEffectiveNodeType().getApplicableChildNodeDef(
-                nodeName, nodeTypeName, ntMgr.getNodeTypeRegistry());
+                nodeName, nodeTypeName, sessionContext.getNodeTypeRegistry());
         return ntMgr.getNodeDefinition(cnd);
     }
 
@@ -807,7 +806,7 @@ public class NodeImpl extends ItemImpl i
                         propertyName, PropertyType.UNDEFINED, multiValued);
             }
         }
-        return session.getNodeTypeManager().getPropertyDefinition(pd);
+        return sessionContext.getNodeTypeManager().getPropertyDefinition(pd);
     }
 
     protected void makePersistent() throws InvalidItemStateException {
@@ -924,8 +923,7 @@ public class NodeImpl extends ItemImpl i
 
         // check effective node type
         try {
-            NodeTypeRegistry registry =
-                session.getNodeTypeManager().getNodeTypeRegistry();
+            NodeTypeRegistry registry = sessionContext.getNodeTypeRegistry();
             EffectiveNodeType type =
                 registry.getEffectiveNodeType(primary, mixins);
             return type.includesNodeType(ntName);
@@ -1214,15 +1212,15 @@ public class NodeImpl extends ItemImpl i
         // Check the explicitly specified node type (if any)
         NodeTypeImpl nt = null;
         if (nodeTypeName != null) {
-            nt = session.getNodeTypeManager().getNodeType(nodeTypeName);
+            nt = sessionContext.getNodeTypeManager().getNodeType(nodeTypeName);
             if (nt.isMixin()) {
                 throw new ConstraintViolationException(
                         "Unable to add a node with a mixin node type: "
-                        + session.getJCRName(nodeTypeName));
+                        + sessionContext.getJCRName(nodeTypeName));
             } else if (nt.isAbstract()) {
                 throw new ConstraintViolationException(
                         "Unable to add a node with an abstract node type: "
-                        + session.getJCRName(nodeTypeName));
+                        + sessionContext.getJCRName(nodeTypeName));
             } else {
                 // adding a node with explicit specifying the node type name
                 // requires the editing session to have nt_management privilege.
@@ -1238,7 +1236,7 @@ public class NodeImpl extends ItemImpl i
         } catch (RepositoryException e) {
             throw new ConstraintViolationException(
                     "No child node definition for "
-                    + session.getJCRName(nodeName) + " found in " + this, e);
+                    + sessionContext.getJCRName(nodeName) + " found in " + this, e);
         }
 
         // Use default node type from child node definition if needed
@@ -1372,7 +1370,7 @@ public class NodeImpl extends ItemImpl i
             String name;
             try {
                 Path.Element[] path = new Path.Element[] { srcName };
-                name = session.getJCRPath(new PathBuilder(path).getPath());
+                name = sessionContext.getJCRPath(new PathBuilder(path).getPath());
             } catch (NameException e) {
                 name = srcName.toString();
             } catch (NamespaceException e) {
@@ -1386,7 +1384,7 @@ public class NodeImpl extends ItemImpl i
             String name;
             try {
                 Path.Element[] path = new Path.Element[] { dstName };
-                name = session.getJCRPath(new PathBuilder(path).getPath());
+                name = sessionContext.getJCRPath(new PathBuilder(path).getPath());
             } catch (NameException e) {
                 name = dstName.toString();
             } catch (NamespaceException e) {
@@ -1413,7 +1411,7 @@ public class NodeImpl extends ItemImpl i
         pb.addLast(srcName.getName(), srcName.getIndex());
         Path childPath = pb.getPath();
         if (!acMgr.isGranted(childPath, Permission.ADD_NODE | Permission.REMOVE_NODE)) {
-            String msg = "Not allowed to reorder child node " + session.getJCRPath(childPath) + ".";
+            String msg = "Not allowed to reorder child node " + sessionContext.getJCRPath(childPath) + ".";
             log.debug(msg);
             throw new AccessDeniedException(msg);
         }
@@ -1750,7 +1748,7 @@ public class NodeImpl extends ItemImpl i
 
         Path.Element insertName;
         try {
-            Path p = session.getQPath(srcName);
+            Path p = sessionContext.getQPath(srcName);
             // p must be a relative path of length==depth==1 (to eliminate e.g. "..")
             if (p.isAbsolute() || p.getLength() != 1 || p.getDepth() != 1) {
                 throw new RepositoryException("invalid name: " + srcName);
@@ -1765,7 +1763,7 @@ public class NodeImpl extends ItemImpl i
         Path.Element beforeName;
         if (destName != null) {
             try {
-                Path p = session.getQPath(destName);
+                Path p = sessionContext.getQPath(destName);
                 // p must be a relative path of length==depth==1 (to eliminate e.g. "..")
                 if (p.isAbsolute() || p.getLength() != 1 || p.getDepth() != 1) {
                     throw new RepositoryException("invalid name: " + destName);
@@ -1806,7 +1804,7 @@ public class NodeImpl extends ItemImpl i
     public Property setProperty(String name, String[] values, int type)
             throws RepositoryException {
         Value[] converted = getValues(values, type);
-        return setProperty(session.getQName(name), converted, type, true);
+        return setProperty(sessionContext.getQName(name), converted, type, true);
     }
 
     /** Wrapper around {@link #setProperty(String, Value)} */
@@ -1837,14 +1835,14 @@ public class NodeImpl extends ItemImpl i
             value = ValueHelper.convert(value, type, getValueFactory());
         }
         return sessionContext.getSessionState().perform(
-                new SetPropertyOperation(session.getQName(name), value, true));
+                new SetPropertyOperation(sessionContext.getQName(name), value, true));
     }
 
     /** Wrapper around {@link SetPropertyOperation} */
     public Property setProperty(String name, Value value)
             throws RepositoryException {
         return sessionContext.getSessionState().perform(
-                new SetPropertyOperation(session.getQName(name), value, false));
+                new SetPropertyOperation(sessionContext.getQName(name), value, false));
     }
 
     /** Wrapper around {@link #setProperty(String, Value)} */
@@ -2209,7 +2207,7 @@ public class NodeImpl extends ItemImpl i
      */
     public boolean isNodeType(String nodeTypeName) throws RepositoryException {
         try {
-            return isNodeType(session.getQName(nodeTypeName));
+            return isNodeType(sessionContext.getQName(nodeTypeName));
         } catch (NameException e) {
             throw new RepositoryException(
                     "invalid node type name: " + nodeTypeName, e);
@@ -2223,7 +2221,7 @@ public class NodeImpl extends ItemImpl i
         // check state of this instance
         sanityCheck();
 
-        return session.getNodeTypeManager().getNodeType(
+        return sessionContext.getNodeTypeManager().getNodeType(
                 data.getNodeState().getNodeTypeName());
     }
 
@@ -2242,7 +2240,7 @@ public class NodeImpl extends ItemImpl i
         Iterator<Name> iter = mixinNames.iterator();
         int i = 0;
         while (iter.hasNext()) {
-            nta[i++] = session.getNodeTypeManager().getNodeType(iter.next());
+            nta[i++] = sessionContext.getNodeTypeManager().getNodeType(iter.next());
         }
         return nta;
     }
@@ -2250,7 +2248,7 @@ public class NodeImpl extends ItemImpl i
     /** Wrapper around {@link #addMixin(Name)}. */
     public void addMixin(String mixinName) throws RepositoryException {
         try {
-            addMixin(session.getQName(mixinName));
+            addMixin(sessionContext.getQName(mixinName));
         } catch (NameException e) {
             throw new RepositoryException(
                     "Invalid mixin type name: " + mixinName, e);
@@ -2260,7 +2258,7 @@ public class NodeImpl extends ItemImpl i
     /** Wrapper around {@link #removeMixin(Name)}. */
     public void removeMixin(String mixinName) throws RepositoryException {
         try {
-            removeMixin(session.getQName(mixinName));
+            removeMixin(sessionContext.getQName(mixinName));
         } catch (NameException e) {
             throw new RepositoryException(
                     "Invalid mixin type name: " + mixinName, e);
@@ -2275,8 +2273,8 @@ public class NodeImpl extends ItemImpl i
         // check state of this instance
         sanityCheck();
 
-        Name ntName = session.getQName(mixinName);
-        NodeTypeManagerImpl ntMgr = session.getNodeTypeManager();
+        Name ntName = sessionContext.getQName(mixinName);
+        NodeTypeManagerImpl ntMgr = sessionContext.getNodeTypeManager();
         NodeTypeImpl mixin = ntMgr.getNodeType(ntName);
         if (!mixin.isMixin()) {
             return false;
@@ -2433,8 +2431,9 @@ public class NodeImpl extends ItemImpl i
         try {
             // create session on other workspace for current subject
             // (may throw NoSuchWorkspaceException and AccessDeniedException)
-            RepositoryImpl rep = (RepositoryImpl) session.getRepository();
-            srcSession = rep.createSession(session.getSubject(), workspaceName);
+            RepositoryImpl rep = (RepositoryImpl) getSession().getRepository();
+            srcSession = rep.createSession(
+                    sessionContext.getSessionImpl().getSubject(), workspaceName);
 
             // search nearest ancestor that is referenceable
             NodeImpl m1 = this;
@@ -2464,7 +2463,7 @@ public class NodeImpl extends ItemImpl i
             try {
                 Path p = m1.getPrimaryPath().computeRelativePath(getPrimaryPath());
                 // use prefix mappings of srcSession
-                relPath = session.getJCRPath(p);
+                relPath = sessionContext.getJCRPath(p);
             } catch (NameException be) {
                 // should never get here...
                 String msg = "internal error: failed to determine relative path";
@@ -2758,7 +2757,7 @@ public class NodeImpl extends ItemImpl i
      * Returns the version manager of this workspace.
      */
     private VersionManagerImpl getVersionManagerImpl() {
-        return session.getWorkspaceImpl().getVersionManagerImpl();
+        return sessionContext.getSessionImpl().getWorkspaceImpl().getVersionManagerImpl();
     }
 
     /**
@@ -2890,7 +2889,7 @@ public class NodeImpl extends ItemImpl i
             RepositoryException {
         // check state of this instance
         sanityCheck();
-        LockManager lockMgr = session.getWorkspace().getLockManager();
+        LockManager lockMgr = getSession().getWorkspace().getLockManager();
         return lockMgr.lock(getPath(), isDeep, isSessionScoped, Long.MAX_VALUE, null);
     }
 
@@ -2902,7 +2901,7 @@ public class NodeImpl extends ItemImpl i
             AccessDeniedException, RepositoryException {
         // check state of this instance
         sanityCheck();
-        LockManager lockMgr = session.getWorkspace().getLockManager();
+        LockManager lockMgr = getSession().getWorkspace().getLockManager();
         return lockMgr.getLock(getPath());
     }
 
@@ -2915,7 +2914,7 @@ public class NodeImpl extends ItemImpl i
             RepositoryException {
         // check state of this instance
         sanityCheck();
-        LockManager lockMgr = session.getWorkspace().getLockManager();
+        LockManager lockMgr = getSession().getWorkspace().getLockManager();
         lockMgr.unlock(getPath());
     }
 
@@ -2925,7 +2924,7 @@ public class NodeImpl extends ItemImpl i
     public boolean holdsLock() throws RepositoryException {
         // check state of this instance
         sanityCheck();
-        LockManager lockMgr = session.getWorkspace().getLockManager();
+        LockManager lockMgr = getSession().getWorkspace().getLockManager();
         return lockMgr.holdsLock(getPath());
     }
 
@@ -2935,7 +2934,7 @@ public class NodeImpl extends ItemImpl i
     public boolean isLocked() throws RepositoryException {
         // check state of this instance
         sanityCheck();
-        LockManager lockMgr = session.getWorkspace().getLockManager();
+        LockManager lockMgr = getSession().getWorkspace().getLockManager();
         return lockMgr.isLocked(getPath());
     }
 
@@ -2951,7 +2950,7 @@ public class NodeImpl extends ItemImpl i
             // a new node needs no check
             return;
         }
-        session.getLockManager().checkLock(this);
+        sessionContext.getSessionImpl().getLockManager().checkLock(this);
     }
 
     //--------------------------------------------------< new JSR 283 methods >
@@ -2978,7 +2977,7 @@ public class NodeImpl extends ItemImpl i
                 if (name != null) {
                     Name qName;
                     try {
-                        qName = session.getQName(name);
+                        qName = sessionContext.getQName(name);
                     } catch (NameException e) {
                         throw new RepositoryException("invalid property name: " + name, e);
                     }
@@ -3016,7 +3015,7 @@ public class NodeImpl extends ItemImpl i
 
         Value ref = getSession().getValueFactory().createValue(this, true);
         List<Property> props = new ArrayList<Property>();
-        QueryManagerImpl qm = (QueryManagerImpl) session.getWorkspace().getQueryManager();
+        QueryManagerImpl qm = (QueryManagerImpl) getSession().getWorkspace().getQueryManager();
         for (Node n : qm.getWeaklyReferringNodes(this)) {
             for (PropertyIterator it = n.getProperties(); it.hasNext(); ) {
                 Property p = it.nextProperty();
@@ -3056,7 +3055,7 @@ public class NodeImpl extends ItemImpl i
             StringBuilder stmt = new StringBuilder();
             stmt.append("//*[@").append(ISO9075.encode(name));
             stmt.append(" = '").append(data.getId()).append("']");
-            Query q = session.getWorkspace().getQueryManager().createQuery(
+            Query q = getSession().getWorkspace().getQueryManager().createQuery(
                     stmt.toString(), Query.XPATH);
             QueryResult result = q.execute();
             ArrayList<Property> l = new ArrayList<Property>();
@@ -3120,13 +3119,13 @@ public class NodeImpl extends ItemImpl i
             throw new RepositoryException(msg);
         }
 
-        Name ntName = session.getQName(nodeTypeName);
+        Name ntName = sessionContext.getQName(nodeTypeName);
         if (ntName.equals(state.getNodeTypeName())) {
             log.debug("Node already has " + nodeTypeName + " as primary node type.");
             return;
         }
 
-        NodeTypeManagerImpl ntMgr = session.getNodeTypeManager();
+        NodeTypeManagerImpl ntMgr = sessionContext.getNodeTypeManager();
         NodeType nt = ntMgr.getNodeType(ntName);
         if (nt.isMixin()) {
             throw new ConstraintViolationException(nodeTypeName + ": not a primary node type.");
@@ -3226,7 +3225,7 @@ public class NodeImpl extends ItemImpl i
                                         ValueHelper.convert(
                                                 prop.getValues(),
                                                 pdi.getRequiredType(),
-                                                session.getValueFactory());
+                                                getSession().getValueFactory());
                                 // redefine property
                                 prop.onRedefine(pdi.unwrap());
                                 // set converted values
@@ -3237,7 +3236,7 @@ public class NodeImpl extends ItemImpl i
                                         ValueHelper.convert(
                                                 prop.getValue(),
                                                 pdi.getRequiredType(),
-                                                session.getValueFactory());
+                                                getSession().getValueFactory());
                                 // redefine property
                                 prop.onRedefine(pdi.unwrap());
                                 // set converted values
@@ -3325,7 +3324,7 @@ public class NodeImpl extends ItemImpl i
             ConstraintViolationException, RepositoryException {
         Value v = null;
         if (value != null) {
-            v = session.getValueFactory().createValue(value);
+            v = getSession().getValueFactory().createValue(value);
         }
         return setProperty(name, v);
     }
@@ -3338,7 +3337,7 @@ public class NodeImpl extends ItemImpl i
             ConstraintViolationException, RepositoryException {
         Value v = null;
         if (value != null) {
-            v = session.getValueFactory().createValue(value);
+            v = getSession().getValueFactory().createValue(value);
         }
         return setProperty(name, v);
     }
@@ -3468,7 +3467,7 @@ public class NodeImpl extends ItemImpl i
 
         Name qName;
         try {
-            qName = session.getQName(newName);
+            qName = sessionContext.getQName(newName);
         } catch (NameException e) {
             throw new RepositoryException("invalid node name: " + newName, e);
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java?rev=985244&r1=985243&r2=985244&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java Fri Aug 13 15:30:46 2010
@@ -44,6 +44,7 @@ import javax.jcr.PathNotFoundException;
 import javax.jcr.Property;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
+import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.Value;
 import javax.jcr.ValueFormatException;
@@ -204,7 +205,7 @@ public class PropertyImpl extends ItemIm
 
     protected void onRedefine(QPropertyDefinition def) throws RepositoryException {
         PropertyDefinitionImpl newDef =
-                session.getNodeTypeManager().getPropertyDefinition(def);
+                sessionContext.getNodeTypeManager().getPropertyDefinition(def);
         data.setDefinition(newDef);
     }
 
@@ -222,7 +223,7 @@ public class PropertyImpl extends ItemIm
         switch (value.getType()) {
             case NAME:
             case PATH:
-                String str = ValueFormat.getJCRString(value, session);
+                String str = ValueFormat.getJCRString(value, sessionContext);
                 length = str.length();
                 break;
             default:
@@ -364,10 +365,10 @@ public class PropertyImpl extends ItemIm
         if (reqType != NAME) {
             // type conversion required
             Value targetValue = ValueHelper.convert(
-                    ValueFormat.getJCRValue(InternalValue.create(name), session, session.getValueFactory()),
-                    reqType, session.getValueFactory());
+                    ValueFormat.getJCRValue(InternalValue.create(name), sessionContext, getSession().getValueFactory()),
+                    reqType, getSession().getValueFactory());
             internalValue = InternalValue.create(
-                    targetValue, session, sessionContext.getDataStore());
+                    targetValue, sessionContext, sessionContext.getDataStore());
         } else {
             // no type conversion required
             internalValue = InternalValue.create(name);
@@ -416,10 +417,10 @@ public class PropertyImpl extends ItemIm
                     if (reqType != NAME) {
                         // type conversion required
                         Value targetValue = ValueHelper.convert(
-                                ValueFormat.getJCRValue(InternalValue.create(name), session, session.getValueFactory()),
-                                reqType, session.getValueFactory());
+                                ValueFormat.getJCRValue(InternalValue.create(name), sessionContext, getSession().getValueFactory()),
+                                reqType, getSession().getValueFactory());
                         internalValue = InternalValue.create(
-                                targetValue, session,
+                                targetValue, sessionContext,
                                 sessionContext.getDataStore());
                     } else {
                         // no type conversion required
@@ -488,14 +489,14 @@ public class PropertyImpl extends ItemIm
         InternalValue[] internals = internalGetValues();
         Value[] values = new Value[internals.length];
         for (int i = 0; i < internals.length; i++) {
-            values[i] = ValueFormat.getJCRValue(internals[i], session, session.getValueFactory());
+            values[i] = ValueFormat.getJCRValue(internals[i], sessionContext, getSession().getValueFactory());
         }
         return values;
     }
 
     public Value getValue() throws RepositoryException {
         try {
-            return ValueFormat.getJCRValue(internalGetValue(), session, session.getValueFactory());
+            return ValueFormat.getJCRValue(internalGetValue(), sessionContext, getSession().getValueFactory());
         } catch (RuntimeException e) {
             String msg = "Internal error while retrieving value of " + this;
             log.error(msg, e);
@@ -541,6 +542,7 @@ public class PropertyImpl extends ItemIm
     }
 
     public Node getNode() throws ValueFormatException, RepositoryException {
+        Session session = getSession();
         Value value = getValue();
         int type = value.getType();
         switch (type) {
@@ -551,7 +553,7 @@ public class PropertyImpl extends ItemIm
             case PATH:
             case NAME:
                 String path = value.getString();
-                Path p = session.getQPath(path);
+                Path p = sessionContext.getQPath(path);
                 boolean absolute = p.isAbsolute();
                 try {
                     return (absolute) ? session.getNode(path) : getParent().getNode(path);
@@ -566,7 +568,7 @@ public class PropertyImpl extends ItemIm
                 } catch (RepositoryException e) {
                     // try if STRING value can be interpreted as PATH value
                     Value pathValue = ValueHelper.convert(value, PATH, session.getValueFactory());
-                    p = session.getQPath(pathValue.getString());
+                    p = sessionContext.getQPath(pathValue.getString());
                     absolute = p.isAbsolute();
                     try {
                         return (absolute) ? session.getNode(pathValue.getString()) : getParent().getNode(pathValue.getString());
@@ -582,17 +584,17 @@ public class PropertyImpl extends ItemIm
 
     public Property getProperty() throws RepositoryException {
         Value value = getValue();
-        Value pathValue = ValueHelper.convert(value, PATH, session.getValueFactory());
+        Value pathValue = ValueHelper.convert(value, PATH, getSession().getValueFactory());
         String path = pathValue.getString();
         boolean absolute;
         try {
-            Path p = session.getQPath(path);
+            Path p = sessionContext.getQPath(path);
             absolute = p.isAbsolute();
         } catch (RepositoryException e) {
             throw new ValueFormatException("Property value cannot be converted to a PATH");
         }
         try {
-            return (absolute) ? session.getProperty(path) : getParent().getProperty(path);
+            return (absolute) ? getSession().getProperty(path) : getParent().getProperty(path);
         } catch (PathNotFoundException e) {
             throw new ItemNotFoundException(path);
         }
@@ -630,7 +632,7 @@ public class PropertyImpl extends ItemIm
     public void setValue(Calendar value) throws RepositoryException {
         if (value != null) {
             try {
-                setValue(session.getValueFactory().createValue(value));
+                setValue(getSession().getValueFactory().createValue(value));
             } catch (IllegalArgumentException e) {
                 throw new ValueFormatException(
                         "Value is not an ISO8601 date: " + value, e);
@@ -731,13 +733,13 @@ public class PropertyImpl extends ItemIm
         if (reqType != value.getType()) {
             // type conversion required
             Value targetVal = ValueHelper.convert(
-                    value, reqType, session.getValueFactory());
+                    value, reqType, getSession().getValueFactory());
             internalValue = InternalValue.create(
-                    targetVal, session, sessionContext.getDataStore());
+                    targetVal, sessionContext, sessionContext.getDataStore());
         } else {
             // no type conversion required
             internalValue = InternalValue.create(
-                    value, session, sessionContext.getDataStore());
+                    value, sessionContext, sessionContext.getDataStore());
         }
         internalSetValue(new InternalValue[]{internalValue}, reqType);
     }
@@ -801,10 +803,10 @@ public class PropertyImpl extends ItemIm
                     }
                     if (reqType != value.getType()) {
                         value = ValueHelper.convert(
-                                value, reqType, session.getValueFactory());
+                                value, reqType, getSession().getValueFactory());
                     }
                     internalValues[i] = InternalValue.create(
-                            value, session, sessionContext.getDataStore());
+                            value, sessionContext, sessionContext.getDataStore());
                 } else {
                     internalValues[i] = null;
                 }
@@ -874,7 +876,7 @@ public class PropertyImpl extends ItemIm
     public String getName() throws RepositoryException {
         // check state of this instance
         sanityCheck();
-        return session.getJCRName(((PropertyId) id).getName());
+        return sessionContext.getJCRName(((PropertyId) id).getName());
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ProtectedItemModifier.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ProtectedItemModifier.java?rev=985244&r1=985243&r2=985244&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ProtectedItemModifier.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ProtectedItemModifier.java Fri Aug 13 15:30:46 2010
@@ -72,7 +72,7 @@ public abstract class ProtectedItemModif
         // validation: make sure Node is not locked or checked-in.
         parentImpl.checkSetProperty();
 
-        NodeTypeImpl nodeType = parentImpl.session.getNodeTypeManager().getNodeType(ntName);
+        NodeTypeImpl nodeType = parentImpl.sessionContext.getNodeTypeManager().getNodeType(ntName);
         org.apache.jackrabbit.spi.commons.nodetype.NodeDefinitionImpl def = parentImpl.getApplicableChildNodeDefinition(name, ntName);
 
         // check for name collisions
@@ -87,7 +87,7 @@ public abstract class ProtectedItemModif
             }
             // check same-name sibling setting of existing node
             NodeId newId = cne.getId();
-            NodeImpl n = (NodeImpl) parentImpl.session.getItemManager().getItem(newId);
+            NodeImpl n = (NodeImpl) parentImpl.sessionContext.getItemManager().getItem(newId);
             if (!n.getDefinition().allowsSameNameSiblings()) {
                 throw new ItemExistsException();
             }
@@ -106,7 +106,7 @@ public abstract class ProtectedItemModif
         }
         // validation: make sure Node is not locked or checked-in.
         parentImpl.checkSetProperty();
-        InternalValue intVs = InternalValue.create(value, parentImpl.session);
+        InternalValue intVs = InternalValue.create(value, parentImpl.sessionContext);
         return parentImpl.internalSetProperty(name, intVs);
     }
 
@@ -116,7 +116,7 @@ public abstract class ProtectedItemModif
         parentImpl.checkSetProperty();
         InternalValue[] intVs = new InternalValue[values.length];
         for (int i = 0; i < values.length; i++) {
-            intVs[i] = InternalValue.create(values[i], parentImpl.session);
+            intVs[i] = InternalValue.create(values[i], parentImpl.sessionContext);
         }
         return parentImpl.internalSetProperty(name, intVs);
     }
@@ -127,7 +127,7 @@ public abstract class ProtectedItemModif
         parentImpl.checkSetProperty();
         InternalValue[] intVs = new InternalValue[values.length];
         for (int i = 0; i < values.length; i++) {
-            intVs[i] = InternalValue.create(values[i], parentImpl.session);
+            intVs[i] = InternalValue.create(values[i], parentImpl.sessionContext);
         }
         return parentImpl.internalSetProperty(name, intVs, type);
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RemoveMixinOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RemoveMixinOperation.java?rev=985244&r1=985243&r2=985244&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RemoveMixinOperation.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RemoveMixinOperation.java Fri Aug 13 15:30:46 2010
@@ -89,8 +89,8 @@ class RemoveMixinOperation implements Se
                     + " not included in " + node);
         }
 
-        NodeTypeManagerImpl ntMgr = session.getNodeTypeManager();
-        NodeTypeRegistry ntReg = ntMgr.getNodeTypeRegistry();
+        NodeTypeManagerImpl ntMgr = context.getNodeTypeManager();
+        NodeTypeRegistry ntReg = context.getNodeTypeRegistry();
 
         // build effective node type of remaining mixin's & primary type
         Set<Name> remainingMixins = new HashSet<Name>(state.getMixinTypeNames());

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java?rev=985244&r1=985243&r2=985244&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java Fri Aug 13 15:30:46 2010
@@ -160,11 +160,6 @@ public class SessionImpl extends Abstrac
         new HashMap<String, Object>();
 
     /**
-     * the node type manager
-     */
-    protected final NodeTypeManagerImpl ntMgr;
-
-    /**
      * the Workspace associated with this session
      */
     protected final WorkspaceImpl wsp;
@@ -256,9 +251,6 @@ public class SessionImpl extends Abstrac
         userId = retrieveUserId(subject, wspConfig.getName());
 
         namePathResolver = new DefaultNamePathResolver(this, this, true);
-        ntMgr = new NodeTypeManagerImpl(
-                repositoryContext.getNodeTypeRegistry(), this,
-                repositoryContext.getDataStore());
         wsp = createWorkspaceInstance(wspConfig);
         context.setItemStateManager(createSessionItemStateManager());
         context.setItemManager(createItemManager());
@@ -313,8 +305,7 @@ public class SessionImpl extends Abstrac
      * @return item manager
      */
     protected ItemManager createItemManager() {
-        ItemManager mgr =
-            new ItemManager(context, ntMgr.getRootNodeDefinition());
+        ItemManager mgr = new ItemManager(context);
         context.getItemStateManager().addListener(mgr);
         return mgr;
     }
@@ -432,7 +423,7 @@ public class SessionImpl extends Abstrac
      * @return the <code>NodeTypeManager</code>
      */
     public NodeTypeManagerImpl getNodeTypeManager() {
-        return ntMgr;
+        return context.getNodeTypeManager();
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java?rev=985244&r1=985243&r2=985244&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java Fri Aug 13 15:30:46 2010
@@ -564,7 +564,7 @@ public class WorkspaceImpl extends Abstr
         // check state of this instance
         sanityCheck();
 
-        return session.getNodeTypeManager();
+        return sessionContext.getNodeTypeManager();
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java?rev=985244&r1=985243&r2=985244&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java Fri Aug 13 15:30:46 2010
@@ -122,12 +122,10 @@ public class NodeTypeManagerImpl extends
      * @param ntReg      node type registry
      * @param session    current session
      * @param store      the data store
-     * @throws RepositoryException If an error occurs.
      */
     @SuppressWarnings("unchecked")
     public NodeTypeManagerImpl(
-            NodeTypeRegistry ntReg, SessionImpl session, DataStore store)
-            throws RepositoryException {
+            NodeTypeRegistry ntReg, SessionImpl session, DataStore store) {
         this.ntReg = ntReg;
         this.session = session;
         this.valueFactory = session.getValueFactory();

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryObjectModelImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryObjectModelImpl.java?rev=985244&r1=985243&r2=985244&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryObjectModelImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryObjectModelImpl.java Fri Aug 13 15:30:46 2010
@@ -113,10 +113,10 @@ public class QueryObjectModelImpl extend
 
         List<ColumnImpl> columns = new ArrayList<ColumnImpl>();
         // expand columns without name
+        NodeTypeManagerImpl ntMgr = sessionContext.getNodeTypeManager();
         for (ColumnImpl column : qomTree.getColumns()) {
             if (column.getColumnName() == null) {
                 QueryObjectModelFactory qomFactory = getQOMFactory();
-                NodeTypeManagerImpl ntMgr = session.getNodeTypeManager();
                 SelectorImpl selector = qomTree.getSelector(column.getSelectorQName());
                 NodeTypeImpl nt = ntMgr.getNodeType(selector.getNodeTypeQName());
                 for (PropertyDefinition pd : nt.getPropertyDefinitions()) {
@@ -168,7 +168,7 @@ public class QueryObjectModelImpl extend
     private void checkNodeTypes() throws InvalidQueryException {
         try {
             final NodeTypeManagerImpl manager =
-                sessionContext.getSessionImpl().getNodeTypeManager();
+                sessionContext.getNodeTypeManager();
             qomTree.accept(new DefaultTraversingQOMTreeVisitor() {
                 public Object visit(SelectorImpl node, Object data) throws Exception {
                     String ntName = node.getNodeTypeName();

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionContext.java?rev=985244&r1=985243&r2=985244&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionContext.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionContext.java Fri Aug 13 15:30:46 2010
@@ -25,6 +25,8 @@ import org.apache.jackrabbit.core.Reposi
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.data.DataStore;
 import org.apache.jackrabbit.core.id.NodeId;
+import org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl;
+import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.core.observation.ObservationManagerImpl;
 import org.apache.jackrabbit.core.security.AccessManager;
 import org.apache.jackrabbit.core.state.SessionItemStateManager;
@@ -56,6 +58,11 @@ public class SessionContext implements N
     private final SessionState state;
 
     /**
+     * Node type manager of this session
+     */
+    private final NodeTypeManagerImpl nodeTypeManager;
+
+    /**
      * The item state manager of this session
      */
     private volatile SessionItemStateManager itemStateManager;
@@ -93,6 +100,9 @@ public class SessionContext implements N
         this.repositoryContext = repositoryContext;
         this.session = session;
         this.state = new SessionState(this);
+        this.nodeTypeManager = new NodeTypeManagerImpl(
+                repositoryContext.getNodeTypeRegistry(), session,
+                repositoryContext.getDataStore());
     }
 
     /**
@@ -124,6 +134,15 @@ public class SessionContext implements N
     }
 
     /**
+     * Returns the node type registry of this repository.
+     *
+     * @return node type registry
+     */
+    public NodeTypeRegistry getNodeTypeRegistry() {
+        return repositoryContext.getNodeTypeRegistry();
+    }
+
+    /**
      * Returns this session.
      *
      * @return session
@@ -141,6 +160,15 @@ public class SessionContext implements N
         return state;
     }
 
+    /**
+     * Returns the node type manager of this session.
+     *
+     * @return node type manager
+     */
+    public NodeTypeManagerImpl getNodeTypeManager() {
+        return nodeTypeManager;
+    }
+
     public SessionItemStateManager getItemStateManager() {
         assert itemStateManager != null;
         return itemStateManager;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java?rev=985244&r1=985243&r2=985244&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java Fri Aug 13 15:30:46 2010
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.core.versi
 
 import org.apache.jackrabbit.core.AbstractNodeData;
 import org.apache.jackrabbit.core.ItemManager;
+import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.security.authorization.Permission;
@@ -73,6 +74,7 @@ public class VersionHistoryImpl extends 
      */
     protected InternalVersionHistory getInternalVersionHistory()
             throws RepositoryException {
+        SessionImpl session = sessionContext.getSessionImpl();
         InternalVersionHistory history =
                 session.getInternalVersionManager().getVersionHistory((NodeId) id);
         if (history == null) {
@@ -85,6 +87,7 @@ public class VersionHistoryImpl extends 
      * @see javax.jcr.version.VersionHistory#getRootVersion()
      */
     public javax.jcr.version.Version getRootVersion() throws RepositoryException {
+        SessionImpl session = sessionContext.getSessionImpl();
         return (Version) session.getNodeById(
                 getInternalVersionHistory().getRootVersion().getId());
     }
@@ -93,8 +96,8 @@ public class VersionHistoryImpl extends 
      * @see javax.jcr.version.VersionHistory#getAllVersions()
      */
     public VersionIterator getAllVersions() throws RepositoryException {
-        return new VersionIteratorImpl(session,
-                getInternalVersionHistory().getRootVersion());
+        return new VersionIteratorImpl(
+                getSession(), getInternalVersionHistory().getRootVersion());
     }
 
     /**
@@ -107,13 +110,15 @@ public class VersionHistoryImpl extends 
     /**
      * @see VersionHistory#getAllLinearVersions()
      */
+    @SuppressWarnings("deprecation")
     public VersionIterator getAllLinearVersions() throws RepositoryException {
         // get base version. this can certainly be optimized
+        SessionImpl session = sessionContext.getSessionImpl();
         InternalVersionHistory vh = getInternalVersionHistory();
         Node vn = session.getNodeById(vh.getVersionableId());
         InternalVersion base = ((VersionImpl) vn.getBaseVersion()).getInternalVersion();
 
-        return new VersionIteratorImpl(session, vh.getRootVersion(), base);
+        return new VersionIteratorImpl(getSession(), vh.getRootVersion(), base);
     }
 
     /**
@@ -129,12 +134,12 @@ public class VersionHistoryImpl extends 
     public javax.jcr.version.Version getVersion(String versionName)
             throws VersionException, RepositoryException {
         try {
-            Name name = session.getQName(versionName);
+            Name name = sessionContext.getQName(versionName);
             InternalVersion v = getInternalVersionHistory().getVersion(name);
             if (v == null) {
                 throw new VersionException("No version with name '" + versionName + "' exists in this version history.");
             }
-            return (Version) session.getNodeById(v.getId());
+            return (Version) sessionContext.getSessionImpl().getNodeById(v.getId());
         } catch (NameException e) {
             throw new VersionException(e);
         }
@@ -145,13 +150,13 @@ public class VersionHistoryImpl extends 
      */
     public javax.jcr.version.Version getVersionByLabel(String label) throws RepositoryException {
         try {
-            Name qLabel = session.getQName(label);
+            Name qLabel = sessionContext.getQName(label);
             InternalVersion v =
                 getInternalVersionHistory().getVersionByLabel(qLabel);
             if (v == null) {
                 throw new VersionException("No version with label '" + label + "' exists in this version history.");
             }
-            return (Version) session.getNodeById(v.getId());
+            return (Version) sessionContext.getSessionImpl().getNodeById(v.getId());
         } catch (NameException e) {
             throw new VersionException(e);
         }
@@ -165,9 +170,10 @@ public class VersionHistoryImpl extends 
         try {
             // check permissions
             checkVersionManagementPermission();
-            session.getInternalVersionManager().setVersionLabel(
-                    session, getInternalVersionHistory(), session.getQName(versionName),
-                    session.getQName(label), move);
+            sessionContext.getSessionImpl().getInternalVersionManager().setVersionLabel(
+                    getSession(), getInternalVersionHistory(),
+                    sessionContext.getQName(versionName),
+                    sessionContext.getQName(label), move);
         } catch (NameException e) {
             throw new VersionException(e);
         }
@@ -180,8 +186,9 @@ public class VersionHistoryImpl extends 
         try {
             // check permissions
             checkVersionManagementPermission();
-            InternalVersion existing = session.getInternalVersionManager().setVersionLabel(
-                    session, getInternalVersionHistory(), null, session.getQName(label), true);
+            InternalVersion existing = sessionContext.getSessionImpl().getInternalVersionManager().setVersionLabel(
+                    getSession(), getInternalVersionHistory(),
+                    null, sessionContext.getQName(label), true);
             if (existing == null) {
                 throw new VersionException("No version with label '" + label + "' exists in this version history.");
             }
@@ -198,7 +205,7 @@ public class VersionHistoryImpl extends 
         Name[] labels = getInternalVersionHistory().getVersionLabels();
         String[] ret = new String[labels.length];
         for (int i = 0; i < labels.length; i++) {
-            ret[i] = session.getJCRName(labels[i]);
+            ret[i] = sessionContext.getJCRName(labels[i]);
         }
         return ret;
     }
@@ -212,7 +219,7 @@ public class VersionHistoryImpl extends 
         Name[] labels = ((VersionImpl) version).getInternalVersion().getLabels();
         String[] ret = new String[labels.length];
         for (int i = 0; i < labels.length; i++) {
-            ret[i] = session.getJCRName(labels[i]);
+            ret[i] = sessionContext.getJCRName(labels[i]);
         }
         return ret;
     }
@@ -222,7 +229,7 @@ public class VersionHistoryImpl extends 
      */
     public boolean hasVersionLabel(String label) throws RepositoryException {
         try {
-            Name qLabel = session.getQName(label);
+            Name qLabel = sessionContext.getQName(label);
             return getInternalVersionHistory().getVersionByLabel(qLabel) != null;
         } catch (NameException e) {
             throw new IllegalArgumentException("Unable to resolve label: " + e);
@@ -236,7 +243,7 @@ public class VersionHistoryImpl extends 
             throws VersionException, RepositoryException {
         checkOwnVersion(version);
         try {
-            Name qLabel = session.getQName(label);
+            Name qLabel = sessionContext.getQName(label);
             return ((VersionImpl) version).getInternalVersion().hasLabel(qLabel);
         } catch (NameException e) {
             throw new VersionException(e);
@@ -252,8 +259,10 @@ public class VersionHistoryImpl extends 
         try {
             // check permissions
             checkVersionManagementPermission();
-            session.getInternalVersionManager().removeVersion(session,
-                    getInternalVersionHistory(), session.getQName(versionName));
+            sessionContext.getSessionImpl().getInternalVersionManager().removeVersion(
+                    getSession(),
+                    getInternalVersionHistory(),
+                    sessionContext.getQName(versionName));
         } catch (NameException e) {
             throw new RepositoryException(e);
         }
@@ -298,7 +307,7 @@ public class VersionHistoryImpl extends 
      */
     private void checkVersionManagementPermission() throws RepositoryException {
         try {
-            session.getAccessManager().checkPermission(getPrimaryPath(), Permission.VERSION_MNGMT);
+            sessionContext.getAccessManager().checkPermission(getPrimaryPath(), Permission.VERSION_MNGMT);
         } catch (ItemNotFoundException e) {
             // ignore.
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionImpl.java?rev=985244&r1=985243&r2=985244&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionImpl.java Fri Aug 13 15:30:46 2010
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.core.versi
 
 import org.apache.jackrabbit.core.ItemManager;
 import org.apache.jackrabbit.core.AbstractNodeData;
+import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.session.SessionContext;
 import org.apache.jackrabbit.core.NodeImpl;
@@ -62,6 +63,7 @@ public class VersionImpl extends NodeImp
      * @throws RepositoryException if the internal version is not available
      */
     protected InternalVersion getInternalVersion() throws RepositoryException {
+        SessionImpl session = sessionContext.getSessionImpl();
         InternalVersion version =
                 session.getInternalVersionManager().getVersion((NodeId) id);
         if (version == null) {
@@ -85,7 +87,7 @@ public class VersionImpl extends NodeImp
         InternalVersion[] suc = getInternalVersion().getSuccessors();
         Version[] ret = new Version[suc.length];
         for (int i = 0; i < suc.length; i++) {
-            ret[i] = (Version) session.getNodeById(suc[i].getId());
+            ret[i] = (Version) sessionContext.getSessionImpl().getNodeById(suc[i].getId());
         }
         return ret;
     }
@@ -98,7 +100,7 @@ public class VersionImpl extends NodeImp
         InternalVersion[] pred = getInternalVersion().getPredecessors();
         Version[] ret = new Version[pred.length];
         for (int i = 0; i < pred.length; i++) {
-            ret[i] = (Version) session.getNodeById(pred[i].getId());
+            ret[i] = (Version) sessionContext.getSessionImpl().getNodeById(pred[i].getId());
         }
         return ret;
     }
@@ -108,6 +110,7 @@ public class VersionImpl extends NodeImp
      */
     public Version getLinearSuccessor() throws RepositoryException {
         // get base version. this can certainly be optimized
+        SessionImpl session = sessionContext.getSessionImpl();
         InternalVersionHistory vh = ((VersionHistoryImpl) getContainingHistory())
                 .getInternalVersionHistory();
         Node vn = session.getNodeById(vh.getVersionableId());
@@ -122,7 +125,7 @@ public class VersionImpl extends NodeImp
      */
     public javax.jcr.version.Version getLinearPredecessor() throws RepositoryException {
         InternalVersion pred = getInternalVersion().getLinearPredecessor();
-        return (Version) session.getNodeById(pred.getId());
+        return (Version) sessionContext.getSessionImpl().getNodeById(pred.getId());
     }
 
     /**
@@ -146,7 +149,7 @@ public class VersionImpl extends NodeImp
      * {@inheritDoc}
      */
     public Node getFrozenNode() throws RepositoryException {
-        return session.getNodeById(getInternalVersion().getFrozenNodeId());
+        return sessionContext.getSessionImpl().getNodeById(getInternalVersion().getFrozenNodeId());
     }
 
     /**



Mime
View raw message