jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1215111 - in /jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy: ChildNodeEntries.java NodeEntry.java
Date Fri, 16 Dec 2011 12:30:38 GMT
Author: mduerig
Date: Fri Dec 16 12:30:37 2011
New Revision: 1215111

URL: http://svn.apache.org/viewvc?rev=1215111&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP)
clean up ChildNodeEntry instances on save and refresh

Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntries.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntries.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntries.java?rev=1215111&r1=1215110&r2=1215111&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntries.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntries.java
Fri Dec 16 12:30:37 2011
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.jcr2spi.hierarchy;
 
 import org.apache.commons.collections.map.ReferenceMap;
+import org.apache.jackrabbit.jcr2spi.operation.Operation;
 import org.apache.jackrabbit.jcr2spi.state.Status;
 import org.apache.jackrabbit.spi.ChildInfo;
 import org.apache.jackrabbit.spi.Name;
@@ -109,13 +110,6 @@ final class ChildNodeEntries {
         }
     }
 
-    /**
-     * All child node entries loaded from the persistence layer.
-     */
-    Iterator<NodeEntry> getLoadedEntries() {
-        return loaded.values().iterator();
-    }
-
     public NodeEntry get(Name nodeName) throws RepositoryException {
         if (removed.contains(nodeName)) {
             return null;
@@ -178,6 +172,35 @@ final class ChildNodeEntries {
         return removedEntry;
     }
 
+    //------------------------------------------< internal >---
+
+    /**
+     * All child node entries loaded from the persistence layer.
+     */
+    Iterator<NodeEntry> getLoadedEntries() {
+        return loaded.values().iterator();
+    }
+
+    void complete(Operation operation) {
+        switch (operation.getStatus()) {
+            case PERSISTED:
+                for (Name name : removed) {
+                    loaded.remove(name);
+                }
+                loaded.putAll(added);
+                added.clear();
+                removed.clear();
+                break;
+            case UNDO:
+                added.clear();
+                removed.clear();
+                break;
+            case PENDING:
+                // ignore
+                break;
+        }
+    }
+
     //------------------------------------------< private >---
 
     private NodeEntry resolve(Name nodeName) throws RepositoryException {
@@ -195,5 +218,4 @@ final class ChildNodeEntries {
             return null;
         }
     }
-
 }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java?rev=1215111&r1=1215110&r2=1215111&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java
Fri Dec 16 12:30:37 2011
@@ -272,6 +272,7 @@ public class NodeEntry extends Hierarchy
     @Override
     public void complete(Operation operation) throws RepositoryException {
         operation.accept(operationVisitor);
+        childNodeEntries.complete(operation);
     }
 
     //----------------------------------------------------------< NodeEntry >---



Mime
View raw message