jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r985833 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: BatchedItemOperations.java NodeImpl.java NodeTypeInstanceHandler.java SessionImpl.java version/VersionManagerImplRestore.java
Date Mon, 16 Aug 2010 09:03:20 GMT
Author: jukka
Date: Mon Aug 16 09:03:20 2010
New Revision: 985833

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

Remove the SessionImpl reference to NodeTypeInstanceHandler

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/NodeImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeTypeInstanceHandler.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/version/VersionManagerImplRestore.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=985833&r1=985832&r2=985833&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
Mon Aug 16 09:03:20 2010
@@ -1255,13 +1255,8 @@ public class BatchedItemOperations exten
         prop.setMultiValued(def.isMultiple());
 
         // compute system generated values if necessary
-        InternalValue[] genValues = session.getNodeTypeInstanceHandler()
-                .computeSystemGeneratedPropertyValues(parent, def);
-        if (genValues != null) {
-            prop.setValues(genValues);
-        } else if (def.getDefaultValues() != null) {
-            prop.setValues(InternalValue.create(def.getDefaultValues()));
-        }
+        new NodeTypeInstanceHandler(session.getUserID()).setDefaultValues(
+                prop, parent, def);
 
         // now add new property entry to parent
         parent.addPropertyName(propName);

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=985833&r1=985832&r2=985833&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
Mon Aug 16 09:03:20 2010
@@ -471,15 +471,9 @@ public class NodeImpl extends ItemImpl i
             propState.setType(type);
             propState.setMultiValued(propDef.isMultiple());
             // compute system generated values if necessary
-            InternalValue[] genValues =
-                sessionContext.getSessionImpl().getNodeTypeInstanceHandler()
-                .computeSystemGeneratedPropertyValues(data.getNodeState(), propDef);
-            if (genValues == null) {
-                genValues = InternalValue.create(propDef.getDefaultValues());
-            }
-            if (genValues != null) {
-                propState.setValues(genValues);
-            }
+            String userId = sessionContext.getSessionImpl().getUserID();
+            new NodeTypeInstanceHandler(userId).setDefaultValues(
+                    propState, data.getNodeState(), propDef);
         } catch (ItemStateException ise) {
             String msg = "failed to add property " + name + " to " + this;
             log.debug(msg);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeTypeInstanceHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeTypeInstanceHandler.java?rev=985833&r1=985832&r2=985833&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeTypeInstanceHandler.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeTypeInstanceHandler.java
Mon Aug 16 09:03:20 2010
@@ -19,7 +19,10 @@ package org.apache.jackrabbit.core;
 import java.util.Calendar;
 import java.util.Set;
 
+import javax.jcr.RepositoryException;
+
 import org.apache.jackrabbit.core.state.NodeState;
+import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.QPropertyDefinition;
@@ -53,6 +56,30 @@ public class NodeTypeInstanceHandler {
     }
 
     /**
+     * Sets the system-generated or node type -specified default values
+     * of the given property. If such values are not specified, then the
+     * property is not modified.
+     *
+     * @param property property state
+     * @param parent parent node state
+     * @param def property definition
+     * @param userId user identifier associated with the current session
+     * @throws RepositoryException if the default values could not be created
+     */
+    public void setDefaultValues(
+            PropertyState property, NodeState parent, QPropertyDefinition def)
+            throws RepositoryException {
+        InternalValue[] values =
+            computeSystemGeneratedPropertyValues(parent, def);
+        if (values == null && def.getDefaultValues() != null) {
+            values = InternalValue.create(def.getDefaultValues());
+        }
+        if (values != null) {
+            property.setValues(values);
+        }
+    }
+
+    /**
      * Computes the values of well-known system (i.e. protected) properties.
      *
      * @param parent the parent node state

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=985833&r1=985832&r2=985833&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
Mon Aug 16 09:03:20 2010
@@ -167,11 +167,6 @@ public class SessionImpl extends Abstrac
     protected final InternalVersionManager versionMgr;
 
     /**
-     * node type instance handler
-     */
-    protected final NodeTypeInstanceHandler ntInstanceHandler;
-
-    /**
      * Listeners (weak references)
      */
     protected final Map<SessionListener, SessionListener> listeners =
@@ -245,7 +240,6 @@ public class SessionImpl extends Abstrac
                 createObservationManager(wspConfig.getName()));
 
         versionMgr = createVersionManager();
-        ntInstanceHandler = new NodeTypeInstanceHandler(userId);
     }
 
     /**
@@ -438,14 +432,6 @@ public class SessionImpl extends Abstrac
     }
 
     /**
-     * Returns the node type instance handler for this session
-     * @return the node type instance handler.
-     */
-    public NodeTypeInstanceHandler getNodeTypeInstanceHandler() {
-        return ntInstanceHandler;
-    }
-
-    /**
      * Sets the named attribute. If the value is <code>null</code>, then
      * the named attribute is removed.
      *

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplRestore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplRestore.java?rev=985833&r1=985832&r2=985833&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplRestore.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplRestore.java
Mon Aug 16 09:03:20 2010
@@ -32,6 +32,7 @@ import javax.jcr.version.VersionManager;
 
 import org.apache.jackrabbit.core.HierarchyManager;
 import org.apache.jackrabbit.core.ItemValidator;
+import org.apache.jackrabbit.core.NodeTypeInstanceHandler;
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.security.authorization.Permission;
 import org.apache.jackrabbit.core.session.SessionContext;
@@ -651,8 +652,9 @@ abstract public class VersionManagerImpl
                                               boolean useDefaultValues)
             throws RepositoryException {
         // compute system generated values if necessary
-        InternalValue[] values = session.getNodeTypeInstanceHandler().
-                computeSystemGeneratedPropertyValues(state.getState(), def);
+        InternalValue[] values =
+            new NodeTypeInstanceHandler(session.getUserID()).
+            computeSystemGeneratedPropertyValues(state.getState(), def);
         if (values == null && useDefaultValues) {
             values = InternalValue.create(def.getDefaultValues());
         }



Mime
View raw message