jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1489760 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ oak-jcr/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/
Date Wed, 05 Jun 2013 09:16:33 GMT
Author: mduerig
Date: Wed Jun  5 09:16:32 2013
New Revision: 1489760

URL: http://svn.apache.org/r1489760
Log:
OAK-775 Implement backward compatible observation
support noLocal flag

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ChangeProcessor.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventFilter.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ObservationManagerImpl.java
    jackrabbit/oak/trunk/oak-jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ChangeProcessor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ChangeProcessor.java?rev=1489760&r1=1489759&r2=1489760&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ChangeProcessor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ChangeProcessor.java
Wed Jun  5 09:16:32 2013
@@ -125,7 +125,8 @@ class ChangeProcessor implements Runnabl
         running = true;
         try{
             ChangeSet changes = changeListener.getChanges();
-            if (changes != null) {
+            if (changes != null &&
+                    !(filterRef.get().excludeLocal() && changes.isLocal(observationManager.getContentSession())))
{
                 EventGeneratingNodeStateDiff diff = new EventGeneratingNodeStateDiff(changes);
                 changes.diff(diff);
                 if (!stopping) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventFilter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventFilter.java?rev=1489760&r1=1489759&r2=1489760&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventFilter.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventFilter.java
Wed Jun  5 09:16:32 2013
@@ -44,7 +44,7 @@ class EventFilter {
     private final boolean deep;
     private final String[] uuid;          // TODO implement filtering by uuid
     private final String[] nodeTypeOakName;
-    private final boolean noLocal;        // TODO implement filtering by noLocal
+    private final boolean noLocal;
 
     public EventFilter(ReadOnlyNodeTypeManager ntMgr,
             NamePathMapper namePathMapper, int eventTypes,
@@ -74,6 +74,10 @@ class EventFilter {
                 deep && PathUtils.isAncestor(this.path, path);
     }
 
+    public boolean excludeLocal() {
+        return noLocal;
+    }
+
     @Override
     public String toString() {
         return toStringHelper(this)

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ObservationManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ObservationManagerImpl.java?rev=1489760&r1=1489759&r2=1489760&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ObservationManagerImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ObservationManagerImpl.java
Wed Jun  5 09:16:32 2013
@@ -31,6 +31,7 @@ import javax.jcr.observation.EventListen
 import javax.jcr.observation.ObservationManager;
 
 import org.apache.jackrabbit.commons.iterator.EventListenerIteratorAdapter;
+import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.core.ContentRepositoryImpl;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
 import org.apache.jackrabbit.oak.plugins.nodetype.ReadOnlyNodeTypeManager;
@@ -47,14 +48,16 @@ public class ObservationManagerImpl impl
     private final Map<EventListener, ChangeProcessor> processors = new HashMap<EventListener,
ChangeProcessor>();
     private final AtomicBoolean hasEvents = new AtomicBoolean(false);
     private final ContentRepositoryImpl contentRepository;
+    private final ContentSession contentSession;
     private final ReadOnlyNodeTypeManager ntMgr;
     private final NamePathMapper namePathMapper;
     private final ScheduledExecutorService executor;
 
-    public ObservationManagerImpl(ContentRepositoryImpl contentRepository, ReadOnlyNodeTypeManager
nodeTypeManager,
-            NamePathMapper namePathMapper, ScheduledExecutorService executor) {
+    public ObservationManagerImpl(ContentRepositoryImpl contentRepository, ContentSession
contentSession,
+            ReadOnlyNodeTypeManager nodeTypeManager, NamePathMapper namePathMapper, ScheduledExecutorService
executor) {
 
         this.contentRepository = contentRepository;
+        this.contentSession = contentSession;
         this.ntMgr = nodeTypeManager;
         this.namePathMapper = namePathMapper;
         this.executor = executor;
@@ -136,4 +139,8 @@ public class ObservationManagerImpl impl
     Listener newChangeListener() {
         return contentRepository.newListener();
     }
+
+    public ContentSession getContentSession() {
+        return contentSession;
+    }
 }

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1489760&r1=1489759&r2=1489760&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Wed Jun  5 09:16:32 2013
@@ -225,7 +225,6 @@
       org.apache.jackrabbit.test.api.observation.NodeMovedTest#testMoveNode
       org.apache.jackrabbit.test.api.observation.NodeMovedTest#testMoveTree
       org.apache.jackrabbit.test.api.observation.NodeMovedTest#testMoveWithRemove
-      org.apache.jackrabbit.test.api.observation.AddEventListenerTest#testNoLocalTrue
       org.apache.jackrabbit.test.api.observation.GetIdentifierTest#testNodeAdded
       org.apache.jackrabbit.test.api.observation.GetIdentifierTest#testNodeMoved
       org.apache.jackrabbit.test.api.observation.GetIdentifierTest#testNodeRemoved

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java?rev=1489760&r1=1489759&r2=1489760&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
Wed Jun  5 09:16:32 2013
@@ -249,10 +249,10 @@ public abstract class SessionContext imp
             if (!(contentRepository instanceof ContentRepositoryImpl)) {
                 throw new UnsupportedRepositoryOperationException("Observation not supported");
             }
-
             observationManager = new ObservationManagerImpl(
                 // FIXME avoid casting to implementation
                 ((ContentRepositoryImpl) contentRepository),
+                getSessionDelegate().getContentSession(),
                 ReadOnlyNodeTypeManager.getInstance(delegate.getRoot(), namePathMapper),
                 namePathMapper, repository.getObservationExecutor());
         }



Mime
View raw message