You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by st...@apache.org on 2016/10/31 10:15:30 UTC

svn commit: r1767238 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/filter: ./ FilterFactory.java OakEventFilter.java package-info.java

Author: stefanegli
Date: Mon Oct 31 10:15:30 2016
New Revision: 1767238

URL: http://svn.apache.org/viewvc?rev=1767238&view=rev
Log:
OAK-5013 : introducing o.a.j.o.jcr.observation.filter.FilterFactory and OakEventFilter which allow to expose Oak specific filter extensions

Added:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/filter/
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/filter/FilterFactory.java   (with props)
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/filter/OakEventFilter.java   (with props)
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/filter/package-info.java   (with props)

Added: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/filter/FilterFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/filter/FilterFactory.java?rev=1767238&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/filter/FilterFactory.java (added)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/filter/FilterFactory.java Mon Oct 31 10:15:30 2016
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.jcr.observation.filter;
+
+import org.apache.jackrabbit.api.observation.JackrabbitEventFilter;
+import org.apache.jackrabbit.oak.jcr.observation.OakEventFilterImpl;
+import org.apache.jackrabbit.oak.jcr.observation.ObservationManagerImpl;
+
+/**
+ * Static factory that allows wrapping a JackrabbitEventFilter into an
+ * OakEventFilter that contains some oak specific extensions.
+ * <p>
+ * The resulting filter can subsequently be used in
+ * ObservationManagerImpl.addEventListener as usual.
+ * 
+ * @see ObservationManagerImpl#addEventListener(javax.jcr.observation.EventListener,
+ *      JackrabbitEventFilter)
+ */
+public class FilterFactory {
+
+    /**
+     * Wrap a JackrabbitEventFilter into its corresponding oak extension,
+     * OakEventFilter, on which some Oak specific observation filter extensions
+     * can then be used.
+     * 
+     * @param baseFilter
+     *            the base filter which contains other properties. Changes to
+     *            the resulting oak filter "write-through" to the underlying
+     *            baseFilter (for the features covered by the underlying) and
+     *            similarly changes to the baseFilter are seen by the resulting
+     *            oak filter. Note that this "write-through" behavior does no 
+     *            longer apply after a listener was registered, ie changing
+     *            a filter after registration doesn't alter it for that listener.
+     * @return an OakEventFilter upon which Oak specific observation filtering
+     *         extensions can be activated and then used when adding an
+     *         EventListener with the ObservationManagerImpl.
+     */
+    public static OakEventFilter wrap(JackrabbitEventFilter baseFilter) {
+        return new OakEventFilterImpl(baseFilter);
+    }
+}

Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/filter/FilterFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/filter/OakEventFilter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/filter/OakEventFilter.java?rev=1767238&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/filter/OakEventFilter.java (added)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/filter/OakEventFilter.java Mon Oct 31 10:15:30 2016
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.jcr.observation.filter;
+
+import org.apache.jackrabbit.api.observation.JackrabbitEventFilter;
+
+import aQute.bnd.annotation.ConsumerType;
+
+/**
+ * Extension of the JackrabbitEventFilter that exposes Oak specific
+ * features.
+ * <p>
+ * Usage:
+ * <code>
+ * OakEventFilter oakFilter = FilterFactory.wrap(jackrabbitFilter);
+ * // then call extensions on OakEventFilters
+ * observationManager.addEventListener(listener, oakFilter);  
+ * </code>
+ */
+@ConsumerType
+public abstract class OakEventFilter extends JackrabbitEventFilter {
+
+}

Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/filter/OakEventFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/filter/package-info.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/filter/package-info.java?rev=1767238&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/filter/package-info.java (added)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/filter/package-info.java Mon Oct 31 10:15:30 2016
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * TODO will have to be switched to 1.0.0 before oak 1.5.13 is released!
+ */
+@Version("0.0.0")
+package org.apache.jackrabbit.oak.jcr.observation.filter;
+
+import aQute.bnd.annotation.Version;
\ No newline at end of file

Propchange: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/filter/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native