jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1618137 - in /jackrabbit/trunk: jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitEventFilter.java jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java
Date Fri, 15 Aug 2014 10:12:00 GMT
Author: mduerig
Date: Fri Aug 15 10:11:59 2014
New Revision: 1618137

URL: http://svn.apache.org/r1618137
Log:
JCR-3797: Add path exclusion to JackrabbitEventFilter

Modified:
    jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitEventFilter.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java

Modified: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitEventFilter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitEventFilter.java?rev=1618137&r1=1618136&r2=1618137&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitEventFilter.java
(original)
+++ jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitEventFilter.java
Fri Aug 15 10:11:59 2014
@@ -39,11 +39,14 @@ import static java.util.Arrays.copyOf;
  * {@link javax.jcr.observation.Event} for details.
  * </li>
  * <li>
- * <code>absPath</code>, <code>absPaths</code> <code>isDeep</code>:
- * Only events whose associated parent node is at one of the paths in
- * <code>absPath</code> or <code>absPaths</code> (or within its subgraph,
- * if <code>isDeep</code> is <code>true</code>) will be received.
It is
- * permissible to register a listener for a path where no node currently exists.
+ * <code>absPath</code>, <code>absPaths</code>, <code>excludedPaths</code>,
+ * <code>isDeep</code>: Only events whose associated parent node is at one
+ * of the paths in <code>absPath</code> or <code>absPaths</code>
(or within
+ * its subgraph, if <code>isDeep</code> is <code>true</code>) will
be received
+ * except if the associated parent node is at one of the paths in
+ * <code>excludedPaths</code> or its subgraph.
+ * It is permissible to register a listener for a path where no node currently
+ * exists.
  * </li>
  * <li>
  * <code>uuid</code>:
@@ -89,6 +92,7 @@ public class JackrabbitEventFilter {  //
     private String[] nodeTypeNames;
     private boolean noLocal;
     private String[] absPaths = new String[]{};
+    private String[] excludedPaths = new String[]{};
     private boolean noExternal;
     private boolean noInternal;
 
@@ -240,6 +244,27 @@ public class JackrabbitEventFilter {  //
     }
 
     /**
+     * Sets the <code>excludedPaths</code> parameter of the filter.
+     * If left unset, this parameter defaults to an empty array.
+     *
+     * @param excludedPaths an absolute path <code>String</code> array.
+     * @return This EventFilter object with the <code>excludedPaths</code> parameter
set.
+     */
+    public JackrabbitEventFilter setExcludedPaths(String... excludedPaths) {
+        this.excludedPaths = copyOf(excludedPaths, excludedPaths.length);
+        return this;
+    }
+
+    /**
+     * Returns the <code>excludedPaths</code> parameter of the filter.
+     *
+     * @return a <code>String</code> array.
+     */
+    public String[] getExcludedPaths() {
+        return copyOf(excludedPaths, excludedPaths.length);
+    }
+
+    /**
      * Sets the <code>noExternal</code> parameter of the filter.
      * If left unset, this parameter defaults to <code>false</code>.
      *

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java?rev=1618137&r1=1618136&r2=1618137&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java
Fri Aug 15 10:11:59 2014
@@ -128,6 +128,12 @@ public class ObservationManagerImpl impl
     public void addEventListener(EventListener listener, JackrabbitEventFilter filter)
             throws RepositoryException {
 
+        String[] excludedPaths = filter.getExcludedPaths();
+        if (excludedPaths.length > 0) {
+            log.warn("JackrabbitEventFilter excludedPaths is not implemented and will be
ignored: {}",
+                    Arrays.toString(excludedPaths));
+        }
+
         List<String> absPaths = new ArrayList<String>(Arrays.asList(filter.getAdditionalPaths()));
         if (filter.getAbsPath() != null) {
             absPaths.add(filter.getAbsPath());



Mime
View raw message