jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1138870 - in /jackrabbit/sandbox/spi2microkernel/src: main/java/org/apache/jackrabbit/spi2microkernel/SubscriptionImpl.java test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
Date Thu, 23 Jun 2011 13:29:22 GMT
Author: mduerig
Date: Thu Jun 23 13:29:21 2011
New Revision: 1138870

URL: http://svn.apache.org/viewvc?rev=1138870&view=rev
Log:
spi2microkernel prototype (WIP)
observation (WIP): removeNode

Modified:
    jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/SubscriptionImpl.java
    jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java

Modified: jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/SubscriptionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/SubscriptionImpl.java?rev=1138870&r1=1138869&r2=1138870&view=diff
==============================================================================
--- jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/SubscriptionImpl.java
(original)
+++ jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/SubscriptionImpl.java
Thu Jun 23 13:29:21 2011
@@ -238,8 +238,6 @@ public class SubscriptionImpl implements
             return events;
         }
 
-        // Event#NODE_ADDED} Event#NODE_REMOVED} Event#PROPERTY_ADDED} Event#PROPERTY_REMOVED}
-        // Event#PROPERTY_CHANGED} Event#NODE_MOVED} Event#PERSIST}
         private void addItem(JsopTokenizer jsopTokenizer, EventTemplate eventTemplate, Collection<Event>
events) {
             Path path = Paths.stringToPath(jsopTokenizer.readString());
             NodeId parentId = createNodeId(getParent(path));
@@ -253,8 +251,7 @@ public class SubscriptionImpl implements
             EventTemplate addItemEvent = eventTemplate.copy();
             addItemEvent.setPath(path);
             addItemEvent.setParentId(parentId);
-            // todo set primaryType, mixinTypes
-            // this needs context in the journal in the case of property events
+            // todo set primaryType, mixinTypes this needs context in the journal in the
case of property events
             // fixme it seems type based filtering does not respect the type hierarchy (see
JCR-2542)
 
             jsopTokenizer.read(':');
@@ -289,16 +286,29 @@ public class SubscriptionImpl implements
         }
 
         private void removeNode(JsopTokenizer jsopTokenizer, EventTemplate eventTemplate,
Collection<Event> events) {
-            // todo implement removeNode
-            // todo consider ways to handle removal of large sub trees
+            Path path = Paths.stringToPath(jsopTokenizer.readString());
+            NodeId parentId = createNodeId(getParent(path));
+            
+            EventTemplate removeNodeEvent = eventTemplate.copy();
+            removeNodeEvent.setType(Event.NODE_REMOVED);
+            removeNodeEvent.setPath(path);
+            removeNodeEvent.setParentId(parentId);
+            removeNodeEvent.setItemId(createNodeId(path));
+            // todo set primaryType, mixinTypes this needs context in the journal
+            // fixme it seems type based filtering does not respect the type hierarchy (see
JCR-2542)
+
+            events.add(removeNodeEvent.buildEvent());
+            // todo consider ways to generate events of (large) sub tree
         }
 
         private void setProperty(JsopTokenizer jsopTokenizer, EventTemplate eventTemplate,
Collection<Event> events) {
             // todo implement setProperty
+            // Event#PROPERTY_REMOVED} Event#PROPERTY_CHANGED}
         }
 
         private void moveNode(JsopTokenizer jsopTokenizer, EventTemplate eventTemplate, Collection<Event>
events) {
             // todo implement moveNode
+            // Event#NODE_MOVED}
         }
 
         private String getString(JSONObject jsonObject, String key, boolean allowNull) {

Modified: jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java?rev=1138870&r1=1138869&r2=1138870&view=diff
==============================================================================
--- jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
(original)
+++ jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
Thu Jun 23 13:29:21 2011
@@ -918,7 +918,7 @@ public class RepositoryTest {
                     }
                 }
             },
-            Event.NODE_ADDED | Event.NODE_MOVED | Event.NODE_MOVED | Event.PROPERTY_ADDED
|
+            Event.NODE_ADDED | Event.NODE_REMOVED | Event.NODE_MOVED | Event.PROPERTY_ADDED
|
             Event.PROPERTY_REMOVED | Event.PROPERTY_CHANGED | Event.PERSIST, "/", true, null,
null, false);
 
         Node n = getNode(testPath);
@@ -957,7 +957,7 @@ public class RepositoryTest {
                     }
                 }
             },
-            Event.NODE_ADDED | Event.NODE_MOVED | Event.NODE_MOVED | Event.PROPERTY_ADDED
|
+            Event.NODE_ADDED | Event.NODE_REMOVED | Event.NODE_MOVED | Event.PROPERTY_ADDED
|
             Event.PROPERTY_REMOVED | Event.PROPERTY_CHANGED | Event.PERSIST, "/", true, null,
null, false);
 
 



Mime
View raw message