jackrabbit-oak-commits mailing list archives

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

URL: http://svn.apache.org/r1489771
Log:
OAK-775 Implement backward compatible observation
add support for Event.getUserData

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ChangeDispatcher.java
    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/ObservationManagerImpl.java
    jackrabbit/oak/trunk/oak-jcr/pom.xml

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ChangeDispatcher.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ChangeDispatcher.java?rev=1489771&r1=1489770&r2=1489771&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ChangeDispatcher.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/ChangeDispatcher.java
Wed Jun  5 09:35:45 2013
@@ -173,7 +173,6 @@ public class ChangeDispatcher {
         public abstract boolean isExternal();
         public abstract boolean isLocal(ContentSession contentSession);
         public abstract String getUserId();
-        public abstract String getUserData();
         public abstract long getDate();
 
         public void diff(NodeStateDiff diff) {
@@ -186,7 +185,6 @@ public class ChangeDispatcher {
                 .add("base", before)
                 .add("head", after)
                 .add("userId", getUserId())
-                .add("userData", getUserData())
                 .add("date", getDate())
                 .toString();
         }
@@ -240,12 +238,6 @@ public class ChangeDispatcher {
             }
 
             @Override
-            public String getUserData() {
-                // TODO implement getUserData
-                return DUMMY_USER_DATA;
-            }
-
-            @Override
             public long getDate() {
                 return date;
             }
@@ -282,11 +274,6 @@ public class ChangeDispatcher {
             }
 
             @Override
-            public String getUserData() {
-                return OAK_UNKNOWN;
-            }
-
-            @Override
             public long getDate() {
                 return 0;
             }

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=1489771&r1=1489770&r2=1489771&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:35:45 2013
@@ -58,6 +58,7 @@ class ChangeProcessor implements Runnabl
     private final NamePathMapper namePathMapper;
     private final EventListener listener;
     private final AtomicReference<EventFilter> filterRef;
+    private final AtomicReference<String> userDataRef = new AtomicReference<String>(null);
 
     private volatile boolean running;
     private volatile boolean stopping;
@@ -80,6 +81,10 @@ class ChangeProcessor implements Runnabl
         filterRef.set(filter);
     }
 
+    public void setUserData(String userData) {
+        userDataRef.set(userData);
+    }
+
     /**
      * Start the change processor on the passed {@code executor}.
      * @param executor
@@ -294,9 +299,9 @@ class ChangeProcessor implements Runnabl
         }
 
         private EventImpl createEvent(int eventType, String jcrPath) {
-            // TODO support, identifier, info
+            // TODO support identifier, info
             return new EventImpl(ChangeProcessor.this, eventType, jcrPath, changes.getUserId(),
-                    null, null, changes.getDate(), changes.getUserData(), changes.isExternal());
+                    null, null, changes.getDate(), userDataRef.get(), changes.isExternal());
         }
 
         private Event generatePropertyEvent(int eventType, String parentPath, PropertyState
property) {

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=1489771&r1=1489770&r2=1489771&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:35:45 2013
@@ -112,7 +112,9 @@ public class ObservationManagerImpl impl
 
     @Override
     public void setUserData(String userData) throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("User data not supported");
+        for (ChangeProcessor processor : processors.values()) {
+            processor.setUserData(userData);
+        }
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1489771&r1=1489770&r2=1489771&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Wed Jun  5 09:35:45 2013
@@ -231,8 +231,6 @@
       org.apache.jackrabbit.test.api.observation.GetIdentifierTest#testPropertyAdded
       org.apache.jackrabbit.test.api.observation.GetIdentifierTest#testPropertyChanged
       org.apache.jackrabbit.test.api.observation.GetIdentifierTest#testPropertyRemoved
-      org.apache.jackrabbit.test.api.observation.GetUserDataTest#testSave
-      org.apache.jackrabbit.test.api.observation.GetUserDataTest#testWorkspaceOperation
       org.apache.jackrabbit.test.api.observation.AddEventListenerTest#testUUID
       org.apache.jackrabbit.test.api.observation.LockingTest#testAddLockToNode
       org.apache.jackrabbit.test.api.observation.LockingTest#testRemoveLockFromNode



Mime
View raw message