jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpfis...@apache.org
Subject svn commit: r642291 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
Date Fri, 28 Mar 2008 16:57:37 GMT
Author: dpfister
Date: Fri Mar 28 09:57:29 2008
New Revision: 642291

URL: http://svn.apache.org/viewvc?rev=642291&view=rev
Log:
JCR-1104 - JSR 283 support
- shareble nodes (work in progress)
- shared set not properly copied

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java?rev=642291&r1=642290&r2=642291&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
Fri Mar 28 09:57:29 2008
@@ -97,17 +97,17 @@
      * different <code>NodeState</code> instances.
      */
     private boolean sharedPropertyNames = false;
-    
+
     /**
      * Shared set, consisting of the parent ids of this shareable node. This
      * entry is {@link Collections.EMPTY_SET} if this node is not shareable.
      */
-    private Set sharedSet = Collections.EMPTY_SET; 
-    
+    private Set sharedSet = Collections.EMPTY_SET;
+
     /**
      * Flag indicating whether we are using a read-write shared set.
      */
-    private boolean sharedSetRW; 
+    private boolean sharedSetRW;
 
     /**
      * Listener.
@@ -166,6 +166,7 @@
                 setModCount(state.getModCount());
             }
             sharedSet = nodeState.sharedSet;
+            sharedSetRW = false;
         }
     }
 
@@ -571,7 +572,7 @@
     public synchronized void setNodeTypeName(Name nodeTypeName) {
         this.nodeTypeName = nodeTypeName;
     }
-    
+
     /**
      * Return a flag indicating whether this state is shareable, i.e. whether
      * there is at least one member inside its shared set.
@@ -579,10 +580,10 @@
     public synchronized boolean isShareable() {
         return sharedSet != Collections.EMPTY_SET;
     }
-    
+
     /**
      * Add a parent to the shared set.
-     * 
+     *
      * @param parentId parent id to add to the shared set
      * @return <code>true</code> if the parent was successfully added;
      *         <code>false</code> otherwise
@@ -593,15 +594,15 @@
             return false;
         }
         if (!sharedSetRW) {
-            sharedSet = new LinkedHashSet();
+            sharedSet = new LinkedHashSet(sharedSet);
             sharedSetRW = true;
         }
         return sharedSet.add(parentId);
     }
-    
+
     /**
      * Return a flag whether the given parent id appears in the shared set.
-     * 
+     *
      * @param parentId parent id
      * @return <code>true</code> if the parent id appears in the shared set;
      *         <code>false</code> otherwise.
@@ -609,10 +610,10 @@
     public synchronized boolean containsShare(NodeId parentId) {
         return sharedSet.contains(parentId);
     }
-    
+
     /**
      * Return the shared set as an unmodifiable collection.
-     * 
+     *
      * @return unmodifiable collection
      */
     public Set getSharedSet() {
@@ -621,11 +622,11 @@
         }
         return Collections.EMPTY_SET;
     }
-    
+
     /**
      * Set the shared set of this state to the shared set of another state.
      * This state will get a deep copy of the shared set given.
-     * 
+     *
      * @param set shared set
      */
     public synchronized void setSharedSet(Set set) {
@@ -633,7 +634,8 @@
             sharedSet = new LinkedHashSet(set);
             sharedSetRW = true;
         } else {
-            sharedSet = Collections.EMPTY_SET;            
+            sharedSet = Collections.EMPTY_SET;
+            sharedSetRW = false;
         }
     }
 
@@ -642,7 +644,7 @@
      * elements in the shared set. If this number is <code>0</code>,
      * the shared set is empty, i.e. there are no more parent items
      * referencing this item and the state is free floating.
-     * 
+     *
      * @param parentId parent id to remove from the shared set
      * @return the number of elements left in the shared set
      */



Mime
View raw message