jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r449673 - /jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java
Date Mon, 25 Sep 2006 13:02:31 GMT
Author: angela
Date: Mon Sep 25 06:02:30 2006
New Revision: 449673

URL: http://svn.apache.org/viewvc?view=rev&rev=449673
Log:
work in progress

- avoid usage of JCR event types for SPI events.

Modified:
    jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java

Modified: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java?view=diff&rev=449673&r1=449672&r2=449673
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java
Mon Sep 25 06:02:30 2006
@@ -56,8 +56,7 @@
         if (et.length == 0 || et.length > 1) {
             throw new IllegalArgumentException("Ambigous event type definition: expected
one single eventtype.");
         }
-        // TODO: server sends JCR-event types. we expect spi-types
-        type = SubscriptionImpl.getJcrEventType(et[0]);
+        type = getSpiEventType(SubscriptionImpl.getJcrEventType(et[0]));
 
         String href = DomUtil.getChildTextTrim(eventElement, DavConstants.XML_HREF, DavConstants.NAMESPACE);
         if (type == Event.NODE_ADDED || type == Event.NODE_REMOVED) {
@@ -86,8 +85,7 @@
     }
 
     public String getUUID() {
-        // TODO not available from XML_EVENT element
-        return null;
+        return itemId.getUUID();
     }
 
     public QName getPrimaryNodeTypeName() {
@@ -102,5 +100,23 @@
 
     public String getUserID() {
         return DomUtil.getChildTextTrim(eventElement, XML_EVENTUSERID, NAMESPACE);
+    }
+
+    //--------------------------------------------------------------------------
+    private static int getSpiEventType(int jcrEventType) {
+        switch (jcrEventType) {
+            case javax.jcr.observation.Event.NODE_ADDED:
+                return Event.NODE_ADDED;
+            case javax.jcr.observation.Event.NODE_REMOVED:
+                return Event.NODE_REMOVED;
+            case javax.jcr.observation.Event.PROPERTY_ADDED:
+                return Event.PROPERTY_ADDED;
+            case javax.jcr.observation.Event.PROPERTY_CHANGED:
+                return Event.PROPERTY_CHANGED;
+            case javax.jcr.observation.Event.PROPERTY_REMOVED:
+                return Event.PROPERTY_REMOVED;
+            default:
+                throw new IllegalArgumentException("Invalid event type: " + jcrEventType);
+        }
     }
 }



Mime
View raw message