jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r985249 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: BatchedItemOperations.java ItemValidator.java SessionImpl.java session/SessionContext.java
Date Fri, 13 Aug 2010 15:39:09 GMT
Author: jukka
Date: Fri Aug 13 15:39:09 2010
New Revision: 985249

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

Make ItemValidator a more integral part of SessionContext.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.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/session/SessionContext.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java?rev=985249&r1=985248&r2=985249&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
Fri Aug 13 15:39:09 2010
@@ -39,6 +39,7 @@ import org.apache.jackrabbit.core.id.Nod
 import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.nodetype.EffectiveNodeType;
 import org.apache.jackrabbit.core.nodetype.NodeTypeConflictException;
+import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.core.retention.RetentionRegistry;
 import org.apache.jackrabbit.core.security.AccessManager;
 import org.apache.jackrabbit.core.security.authorization.Permission;
@@ -718,7 +719,8 @@ public class BatchedItemOperations exten
             }
             // make sure there's an applicable definition for new child node
             EffectiveNodeType entParent = getEffectiveNodeType(parentState);
-            entParent.checkAddNodeConstraints(nodeName, nodeTypeName, ntReg);
+            entParent.checkAddNodeConstraints(
+                    nodeName, nodeTypeName, context.getNodeTypeRegistry());
             QNodeDefinition newNodeDef =
                     findApplicableNodeDefinition(nodeName, nodeTypeName,
                             parentState);
@@ -1908,7 +1910,9 @@ public class BatchedItemOperations exten
         }
 
         try {
-            EffectiveNodeType type = ntReg.getEffectiveNodeType(primary, mixins);
+            NodeTypeRegistry registry = context.getNodeTypeRegistry();
+            EffectiveNodeType type =
+                registry.getEffectiveNodeType(primary, mixins);
             return type.includesNodeType(NameConstants.MIX_REFERENCEABLE);
         } catch (NodeTypeConflictException ntce) {
             String msg = "internal error: failed to build effective node type for node "

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java?rev=985249&r1=985248&r2=985249&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java
Fri Aug 13 15:39:09 2010
@@ -108,11 +108,6 @@ public class ItemValidator {
     protected final SessionContext context;
 
     /**
-     * node type registry
-     */
-    protected final NodeTypeRegistry ntReg;
-
-    /**
      * A bit mask of the checks that are currently enabled. All access to
      * this mask must be synchronized to ensure that only the thread that
      * uses the {@link #performRelaxed(SessionOperation, int)} method will
@@ -125,9 +120,8 @@ public class ItemValidator {
      *
      * @param context component context of this session
      */
-    public ItemValidator(SessionContext context) throws RepositoryException {
+    public ItemValidator(SessionContext context) {
         this.context = context;
-        this.ntReg = context.getRepositoryContext().getNodeTypeRegistry();
     }
 
     /**
@@ -171,8 +165,9 @@ public class ItemValidator {
     public void validate(NodeState nodeState)
             throws ConstraintViolationException, RepositoryException {
         // effective primary node type
+        NodeTypeRegistry registry = context.getNodeTypeRegistry();
         EffectiveNodeType entPrimary =
-                ntReg.getEffectiveNodeType(nodeState.getNodeTypeName());
+            registry.getEffectiveNodeType(nodeState.getNodeTypeName());
         // effective node type (primary type incl. mixins)
         EffectiveNodeType entPrimaryAndMixins = getEffectiveNodeType(nodeState);
         QNodeDefinition def =
@@ -421,7 +416,7 @@ public class ItemValidator {
     public EffectiveNodeType getEffectiveNodeType(NodeState state)
             throws RepositoryException {
         try {
-            return ntReg.getEffectiveNodeType(
+            return context.getNodeTypeRegistry().getEffectiveNodeType(
                     state.getNodeTypeName(), state.getMixinTypeNames());
         } catch (NodeTypeConflictException ntce) {
             String msg = "internal error: failed to build effective node type for node "
@@ -449,7 +444,8 @@ public class ItemValidator {
                                                 NodeState parentState)
             throws RepositoryException, ConstraintViolationException {
         EffectiveNodeType entParent = getEffectiveNodeType(parentState);
-        return entParent.getApplicableChildNodeDef(name, nodeTypeName, ntReg);
+        return entParent.getApplicableChildNodeDef(
+                name, nodeTypeName, context.getNodeTypeRegistry());
     }
 
     /**

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=985249&r1=985248&r2=985249&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:39:09 2010
@@ -254,7 +254,6 @@ public class SessionImpl extends Abstrac
         wsp = createWorkspaceInstance(wspConfig);
         context.setItemStateManager(createSessionItemStateManager());
         context.setItemManager(createItemManager());
-        context.setItemValidator(new ItemValidator(context));
         context.setAccessManager(createAccessManager(subject));
         context.setObservationManager(
                 createObservationManager(wspConfig.getName()));

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=985249&r1=985248&r2=985249&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:39:09 2010
@@ -58,6 +58,11 @@ public class SessionContext implements N
     private final SessionState state;
 
     /**
+     * The item validator of this session
+     */
+    private final ItemValidator itemValidator;
+
+    /**
      * Node type manager of this session
      */
     private final NodeTypeManagerImpl nodeTypeManager;
@@ -73,11 +78,6 @@ public class SessionContext implements N
     private volatile ItemManager itemManager;
 
     /**
-     * The item validator of this session
-     */
-    private volatile ItemValidator itemValidator;
-
-    /**
      * The access manager of this session
      */
     private volatile AccessManager accessManager;
@@ -103,6 +103,7 @@ public class SessionContext implements N
         this.nodeTypeManager = new NodeTypeManagerImpl(
                 repositoryContext.getNodeTypeRegistry(), session,
                 repositoryContext.getDataStore());
+        this.itemValidator = new ItemValidator(this);
     }
 
     /**
@@ -161,6 +162,15 @@ public class SessionContext implements N
     }
 
     /**
+     * Returns the item validator of this session.
+     *
+     * @return item validator
+     */
+    public ItemValidator getItemValidator() {
+        return itemValidator;
+    }
+
+    /**
      * Returns the node type manager of this session.
      *
      * @return node type manager
@@ -194,16 +204,6 @@ public class SessionContext implements N
         this.itemManager = itemManager;
     }
 
-    public ItemValidator getItemValidator() {
-        assert itemValidator != null;
-        return itemValidator;
-    }
-
-    public void setItemValidator(ItemValidator itemValidator) {
-        assert itemValidator != null;
-        this.itemValidator = itemValidator;
-    }
-
     public AccessManager getAccessManager() {
         assert accessManager != null;
         return accessManager;



Mime
View raw message