You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by re...@apache.org on 2011/11/11 14:25:05 UTC

svn commit: r1200872 - /jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java

Author: reschke
Date: Fri Nov 11 13:25:05 2011
New Revision: 1200872

URL: http://svn.apache.org/viewvc?rev=1200872&view=rev
Log:
JCR-2542: spi2dav: EventFilters not respected

Throw when unsupported EventFilters get used (this will make it easier to understand the test failures in the future).

Modified:
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java?rev=1200872&r1=1200871&r2=1200872&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java Fri Nov 11 13:25:05 2011
@@ -2001,6 +2001,7 @@ public class RepositoryServiceImpl imple
     public Subscription createSubscription(SessionInfo sessionInfo,
                                            EventFilter[] filters)
             throws UnsupportedRepositoryOperationException, RepositoryException {
+        checkEventFilterSupport(filters);
         checkSessionInfo(sessionInfo);
         String rootUri = uriResolver.getRootItemUri(sessionInfo.getWorkspaceName());
         String subscriptionId = subscribe(rootUri, S_INFO, null, sessionInfo, null);
@@ -2017,6 +2018,21 @@ public class RepositoryServiceImpl imple
         // do nothing ...
         // this is actually not correct because we listen for everything and
         // rely on the client of the repository service to filter the events
+        checkEventFilterSupport(filters);
+    }
+
+    private void checkEventFilterSupport(EventFilter[] filters) throws UnsupportedRepositoryOperationException {
+        for (EventFilter ef : filters) {
+            if (ef instanceof EventFilterImpl) {
+                EventFilterImpl efi = (EventFilterImpl)ef;
+                if (efi.getNodeTypeNames() != null && ! efi.getNodeTypeNames().isEmpty()) {
+                    throw new UnsupportedRepositoryOperationException("This SPI implementation does not support filtering by node types (see issue JCR-2542)");
+                }
+                if (efi.getNoLocal()) {
+                    throw new UnsupportedRepositoryOperationException("This SPI implementation does not support filtering using the 'noLocal' flag (see issue JCR-2542)");
+                }
+            }
+        }
     }
 
     public void dispose(Subscription subscription) throws RepositoryException {