jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1478014 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins: observation/ observation2/
Date Wed, 01 May 2013 14:21:15 GMT
Author: mduerig
Date: Wed May  1 14:21:15 2013
New Revision: 1478014

URL: http://svn.apache.org/r1478014
Log:
OAK-144: Implement observation
OAK-775: Implement backward compatible observation
Add logging for registration of observation listeners and usage of deprecated methods on Event

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ChangeFilter.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ObservationManagerImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/EventFilter.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/EventImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/ObservationManagerImpl2.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ChangeFilter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ChangeFilter.java?rev=1478014&r1=1478013&r2=1478014&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ChangeFilter.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ChangeFilter.java
Wed May  1 14:21:15 2013
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.oak.plugins.observation;
 
+import static com.google.common.base.Objects.toStringHelper;
+
 import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
 import javax.jcr.RepositoryException;
@@ -34,7 +36,6 @@ import org.slf4j.LoggerFactory;
  * TODO document
  */
 class ChangeFilter {
-
     private static final Logger log = LoggerFactory.getLogger(ChangeFilter.class);
 
     private final ReadOnlyNodeTypeManager ntMgr;
@@ -74,6 +75,18 @@ class ChangeFilter {
                 deep && PathUtils.isAncestor(this.path, path);
     }
 
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("types", eventTypes)
+                .add("path", path)
+                .add("deep", deep)
+                .add("uuids", uuid)
+                .add("node types", nodeTypeOakName)
+                .add("noLocal", noLocal)
+            .toString();
+    }
+
     //-----------------------------< internal >---------------------------------
 
     private boolean include(int eventType) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventImpl.java?rev=1478014&r1=1478013&r2=1478014&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventImpl.java
Wed May  1 14:21:15 2013
@@ -23,10 +23,16 @@ import javax.jcr.RepositoryException;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.observation.Event;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MarkerFactory;
+
 /**
  * TODO document
  */
 public class EventImpl implements Event {
+    private static final Logger log = LoggerFactory.getLogger(EventImpl.class);
+
     private final int type;
     private final String path;
     private final String userID;
@@ -55,6 +61,7 @@ public class EventImpl implements Event 
 
     @Override
     public String getUserID() {
+        log.warn(MarkerFactory.getMarker("deprecation"), "Call to deprecated method getUserId");
         return userID;
     }
 
@@ -70,6 +77,7 @@ public class EventImpl implements Event 
 
     @Override
     public String getUserData() throws RepositoryException {
+        log.warn(MarkerFactory.getMarker("deprecation"), "Call to deprecated method getUserData");
         throw new UnsupportedRepositoryOperationException("User data not supported");
     }
 

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=1478014&r1=1478013&r2=1478014&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 May  1 14:21:15 2013
@@ -35,11 +35,16 @@ import org.apache.jackrabbit.oak.core.Ro
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
 import org.apache.jackrabbit.oak.plugins.nodetype.ReadOnlyNodeTypeManager;
 import org.apache.jackrabbit.oak.spi.observation.ChangeExtractor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MarkerFactory;
 
 /**
  * TODO document
  */
 public class ObservationManagerImpl implements ObservationManager {
+    private static final Logger log = LoggerFactory.getLogger(ObservationManagerImpl.class);
+
     private final RootImpl root;
     private final NamePathMapper namePathMapper;
     private final ScheduledExecutorService executor;
@@ -78,10 +83,14 @@ public class ObservationManagerImpl impl
                 absPath, isDeep, uuid, nodeTypeName, noLocal);
         ChangeProcessor processor = processors.get(listener);
         if (processor == null) {
+            log.error(MarkerFactory.getMarker("observation"),
+                    "Registering event listener {} with filter {}", listener, filter);
             processor = new ChangeProcessor(this, listener, filter);
             processors.put(listener, processor);
             processor.start(executor);
         } else {
+            log.debug(MarkerFactory.getMarker("observation"),
+                    "Changing event listener {} to filter {}", listener, filter);
             processor.setFilter(filter);
         }
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/EventFilter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/EventFilter.java?rev=1478014&r1=1478013&r2=1478014&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/EventFilter.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/EventFilter.java
Wed May  1 14:21:15 2013
@@ -19,6 +19,7 @@
 
 package org.apache.jackrabbit.oak.plugins.observation2;
 
+import static com.google.common.base.Objects.toStringHelper;
 import static org.apache.jackrabbit.oak.plugins.observation2.ObservationConstants.DEEP;
 import static org.apache.jackrabbit.oak.plugins.observation2.ObservationConstants.NODE_TYPES;
 import static org.apache.jackrabbit.oak.plugins.observation2.ObservationConstants.NO_LOCAL;
@@ -66,6 +67,18 @@ class EventFilter {
                 && includeNodeType(associatedType, ntMgr);
     }
 
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("types", eventTypes)
+                .add("path", path)
+                .add("deep", deep)
+                .add("uuids", uuid)
+                .add("node types", nodeTypeNames)
+                .add("noLocal", noLocal)
+            .toString();
+    }
+
     //-----------------------------< internal >---------------------------------
 
     private boolean includeEventType(int eventType) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/EventImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/EventImpl.java?rev=1478014&r1=1478013&r2=1478014&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/EventImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/EventImpl.java
Wed May  1 14:21:15 2013
@@ -24,10 +24,16 @@ import java.util.Map;
 import javax.jcr.RepositoryException;
 import javax.jcr.observation.Event;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MarkerFactory;
+
 /**
  * TODO document
  */
 public class EventImpl implements Event {
+    private static final Logger log = LoggerFactory.getLogger(EventImpl.class);
+
     private final int type;
     private final String path;
     private final String userID;
@@ -58,6 +64,7 @@ public class EventImpl implements Event 
 
     @Override
     public String getUserID() {
+        log.warn(MarkerFactory.getMarker("deprecation"), "Call to deprecated method getUserId");
         return userID;
     }
 
@@ -73,6 +80,7 @@ public class EventImpl implements Event 
 
     @Override
     public String getUserData() throws RepositoryException {
+        log.warn(MarkerFactory.getMarker("deprecation"), "Call to deprecated method getUserData");
         return userData;
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/ObservationManagerImpl2.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/ObservationManagerImpl2.java?rev=1478014&r1=1478013&r2=1478014&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/ObservationManagerImpl2.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation2/ObservationManagerImpl2.java
Wed May  1 14:21:15 2013
@@ -45,6 +45,7 @@ import org.apache.jackrabbit.oak.namepat
 import org.apache.jackrabbit.oak.plugins.nodetype.ReadOnlyNodeTypeManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.slf4j.MarkerFactory;
 
 /**
  * TODO document
@@ -147,10 +148,14 @@ public class ObservationManagerImpl2 imp
         EventCollector collector = collectors.get(listener);
         try {
             if (collector == null) {
+                log.error(MarkerFactory.getMarker("observation"),
+                        "Registering event listener {} with filter {}", listener, filter);
                 collector = new EventCollector(this, listener, filter);
                 collectors.put(listener, collector);
                 collector.start(executor);
             } else {
+                log.debug(MarkerFactory.getMarker("observation"),
+                        "Changing event listener {} to filter {}", listener, filter);
                 collector.updateFilter(filter);
             }
         } catch (CommitFailedException e) {



Mime
View raw message