jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r1228091 - in /jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk: MicroKernelImpl.java model/AbstractNode.java model/NodeDelta.java model/NodeDiffHandler.java model/TraversingNodeDiffHandler.java
Date Fri, 06 Jan 2012 11:19:10 GMT
Author: stefan
Date: Fri Jan  6 11:19:09 2012
New Revision: 1228091

URL: http://svn.apache.org/viewvc?rev=1228091&view=rev
Log:
flat hierarchy support (WIP):

refactored child node entries collection

Modified:
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelImpl.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/AbstractNode.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/NodeDelta.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/NodeDiffHandler.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/TraversingNodeDiffHandler.java

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelImpl.java?rev=1228091&r1=1228090&r2=1228091&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelImpl.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelImpl.java
Fri Jan  6 11:19:09 2012
@@ -254,23 +254,23 @@ public class MicroKernelImpl implements 
                 }
 
                 @Override
-                public void childNodeAdded(String childName, String id) {
-                    addedNodes.put(id, PathUtils.concat(getCurrentPath(), childName));
+                public void childNodeAdded(ChildNodeEntry added) {
+                    addedNodes.put(added.getId(), PathUtils.concat(getCurrentPath(), added.getName()));
                     buff.tag('+').
-                            key(PathUtils.concat(getCurrentPath(), childName)).object();
+                            key(PathUtils.concat(getCurrentPath(), added.getName())).object();
                     try {
-                        toJson(buff, rep.getRevisionStore().getNode(id), Integer.MAX_VALUE,
0, -1, false);
+                        toJson(buff, rep.getRevisionStore().getNode(added.getId()), Integer.MAX_VALUE,
0, -1, false);
                     } catch (Exception e) {
-                        buff.value("ERROR: failed to retrieve node " + id);
+                        buff.value("ERROR: failed to retrieve node " + added.getId());
                     }
                     buff.endObject().newline();
                 }
 
                 @Override
-                public void childNodeDeleted(String childName, String id) {
-                    removedNodes.put(id, PathUtils.concat(getCurrentPath(), childName));
+                public void childNodeDeleted(ChildNodeEntry deleted) {
+                    removedNodes.put(deleted.getId(), PathUtils.concat(getCurrentPath(),
deleted.getName()));
                     buff.tag('-');
-                    buff.value(PathUtils.concat(getCurrentPath(), childName));
+                    buff.value(PathUtils.concat(getCurrentPath(), deleted.getName()));
                     buff.newline();
                 }
             };
@@ -318,29 +318,29 @@ public class MicroKernelImpl implements 
                     }
 
                     @Override
-                    public void childNodeAdded(String childName, String id) {
-                        if (addedNodes.containsKey(id)) {
+                    public void childNodeAdded(ChildNodeEntry added) {
+                        if (addedNodes.containsKey(added.getId())) {
                             // moved node, will be processed separately
                             return;
                         }
                         buff.tag('+').
-                                key(PathUtils.concat(getCurrentPath(), childName)).object();
+                                key(PathUtils.concat(getCurrentPath(), added.getName())).object();
                         try {
-                            toJson(buff, rep.getRevisionStore().getNode(id), Integer.MAX_VALUE,
0, -1, false);
+                            toJson(buff, rep.getRevisionStore().getNode(added.getId()), Integer.MAX_VALUE,
0, -1, false);
                         } catch (Exception e) {
-                            buff.value("ERROR: failed to retrieve node " + id);
+                            buff.value("ERROR: failed to retrieve node " + added.getId());
                         }
                         buff.endObject().newline();
                     }
 
                     @Override
-                    public void childNodeDeleted(String childName, String id) {
-                        if (addedNodes.containsKey(id)) {
+                    public void childNodeDeleted(ChildNodeEntry deleted) {
+                        if (addedNodes.containsKey(deleted.getId())) {
                             // moved node, will be processed separately
                             return;
                         }
                         buff.tag('-');
-                        buff.value(PathUtils.concat(getCurrentPath(), childName));
+                        buff.value(PathUtils.concat(getCurrentPath(), deleted.getName()));
                         buff.newline();
                     }
 
@@ -351,9 +351,9 @@ public class MicroKernelImpl implements 
                 for (Map.Entry<String, String> entry : addedNodes.entrySet()) {
                     buff.tag('>').
                             // path/to/deleted/node
-                                    key(removedNodes.get(entry.getKey())).
+                            key(removedNodes.get(entry.getKey())).
                             // path/to/added/node
-                                    value(entry.getValue()).
+                            value(entry.getValue()).
                             newline();
                 }
             }

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/AbstractNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/AbstractNode.java?rev=1228091&r1=1228090&r2=1228091&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/AbstractNode.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/AbstractNode.java
Fri Jan  6 11:19:09 2012
@@ -160,17 +160,15 @@ public abstract class AbstractNode imple
         if (other instanceof AbstractNode) {
             ChildNodeEntries otherEntries = ((AbstractNode) other).childEntries;
             for (Iterator<ChildNodeEntry> it = childEntries.getAdded(otherEntries);
it.hasNext(); ) {
-                ChildNodeEntry added = it.next();
-                handler.childNodeAdded(added.getName(), added.getId());
+                handler.childNodeAdded(it.next());
             }
             for (Iterator<ChildNodeEntry> it = childEntries.getRemoved(otherEntries);
it.hasNext(); ) {
-                ChildNodeEntry removed = it.next();
-                handler.childNodeDeleted(removed.getName(), removed.getId());
+                handler.childNodeDeleted(it.next());
             }
             for (Iterator<ChildNodeEntry> it = childEntries.getModified(otherEntries);
it.hasNext(); ) {
                 ChildNodeEntry old = it.next();
                 ChildNodeEntry modified = otherEntries.get(old.getName());
-                handler.childNodeChanged(old.getName(), old.getId(), modified.getId());
+                handler.childNodeChanged(old, modified.getId());
             }
             return;
         }
@@ -190,18 +188,18 @@ public abstract class AbstractNode imple
             set.addAll(oldEntries.keySet());
             set.removeAll(newEntries.keySet());
             for (String name : set) {
-                handler.childNodeDeleted(name, oldEntries.get(name).getId());
+                handler.childNodeDeleted(oldEntries.get(name));
             }
             set.clear();
             set.addAll(newEntries.keySet());
             set.removeAll(oldEntries.keySet());
             for (String name : set) {
-                handler.childNodeAdded(name, newEntries.get(name).getId());
+                handler.childNodeAdded(newEntries.get(name));
             }
             for (ChildNodeEntry cneOld : oldEntries.values()) {
                 ChildNodeEntry cneNew = newEntries.get(cneOld.getName());
                 if (cneNew != null && !cneNew.getId().equals(cneOld.getId())) {
-                    handler.childNodeChanged(cneOld.getName(), cneOld.getId(), cneNew.getId());
+                    handler.childNodeChanged(cneOld, cneNew.getId());
                 }
             }
         }

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/NodeDelta.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/NodeDelta.java?rev=1228091&r1=1228090&r2=1228091&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/NodeDelta.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/NodeDelta.java
Fri Jan  6 11:19:09 2012
@@ -182,17 +182,16 @@ public class NodeDelta implements NodeDi
         removedProperties.put(propName, value);
     }
 
-    public void childNodeAdded(String childName, String id) {
-        addedChildNodes.put(childName, id);
+    public void childNodeAdded(ChildNodeEntry added) {
+        addedChildNodes.put(added.getName(), added.getId());
     }
 
-    public void childNodeDeleted(String childName, String id) {
-        removedChildNodes.put(childName, id);
+    public void childNodeDeleted(ChildNodeEntry deleted) {
+        removedChildNodes.put(deleted.getName(), deleted.getId());
     }
 
-    public void childNodeChanged(String childName,
-                                 String oldId, String newId) {
-        changedChildNodes.put(childName, newId);
+    public void childNodeChanged(ChildNodeEntry changed, String newId) {
+        changedChildNodes.put(changed.getName(), newId);
     }
 
     //--------------------------------------------------------< inner classes >

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/NodeDiffHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/NodeDiffHandler.java?rev=1228091&r1=1228090&r2=1228091&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/NodeDiffHandler.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/NodeDiffHandler.java
Fri Jan  6 11:19:09 2012
@@ -27,9 +27,9 @@ public interface NodeDiffHandler {
 
     void propDeleted(String propName, String value);
 
-    void childNodeAdded(String childName, String id);
+    void childNodeAdded(ChildNodeEntry added);
 
-    void childNodeDeleted(String childName, String id);
+    void childNodeDeleted(ChildNodeEntry deleted);
 
-    void childNodeChanged(String childName, String oldId, String newId);
+    void childNodeChanged(ChildNodeEntry changed, String newId);
 }

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/TraversingNodeDiffHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/TraversingNodeDiffHandler.java?rev=1228091&r1=1228090&r2=1228091&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/TraversingNodeDiffHandler.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/TraversingNodeDiffHandler.java
Fri Jan  6 11:19:09 2012
@@ -65,16 +65,16 @@ public abstract class TraversingNodeDiff
     public void propDeleted(String propName, String value) {
     }
 
-    public void childNodeAdded(String childName, String id) {
+    public void childNodeAdded(ChildNodeEntry added) {
     }
 
-    public void childNodeDeleted(String childName, String id) {
+    public void childNodeDeleted(ChildNodeEntry deleted) {
     }
 
-    public void childNodeChanged(String childName, String oldId, String newId) {
-        paths.push(PathUtils.concat(getCurrentPath(), childName));
+    public void childNodeChanged(ChildNodeEntry changed, String newId) {
+        paths.push(PathUtils.concat(getCurrentPath(), changed.getName()));
         try {
-            store.getNode(oldId).diff(store.getNode(newId), this);
+            store.getNode(changed.getId()).diff(store.getNode(newId), this);
         } catch (Exception e) {
             throw new RuntimeException(e);
         }



Mime
View raw message