Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventFilter.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventFilter.java (revision eb28325c1fb2eeb7f3fc870b948af2748429a4d2)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventFilter.java (revision )
@@ -82,6 +82,12 @@
private final boolean noExternal;
/**
+ * If noInternal is true this filter will block events from
+ * this cluster nodes.
+ */
+ private final boolean noInternal;
+
+ /**
* Creates a new EventFilter instance.
*
* @param session the Session that registered the {@link
@@ -100,6 +106,10 @@
* @param noLocal if true no events are allowed that were
* created from changes related to the Session
* that registered the {@link javax.jcr.observation.EventListener}.
+ * @param noExternal if true no events are allowed that were
+ * created from changes on an external cluster node.
+ * @param noInternal if true no events are allowed that were
+ * created from changes on the local cluster node.
*/
EventFilter(SessionImpl session,
long eventTypes,
@@ -108,7 +118,8 @@
NodeId[] ids,
NodeTypeImpl[] nodeTypes,
boolean noLocal,
- boolean noExternal) {
+ boolean noExternal,
+ boolean noInternal) {
this.session = session;
this.eventTypes = eventTypes;
this.paths = paths;
@@ -116,6 +127,7 @@
this.ids = ids;
this.noLocal = noLocal;
this.noExternal = noExternal;
+ this.noInternal = noInternal;
this.nodeTypes = nodeTypes;
}
@@ -147,6 +159,10 @@
return true;
}
+ if (noInternal && !eventState.isExternal()) {
+ return true;
+ }
+
// UUIDs, types, and paths do not need to match for persist
if (eventState.getType() == Event.PERSIST) {
return false;
@@ -203,7 +219,7 @@
* Creates a new BlockAllFilter.
*/
BlockAllFilter() {
- super(null, 0, Collections.emptyList(), true, null, null, true, true);
+ super(null, 0, Collections.emptyList(), true, null, null, true, true, true);
}
/**
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java (revision eb28325c1fb2eeb7f3fc870b948af2748429a4d2)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java (revision )
@@ -119,7 +119,7 @@
// create filter
EventFilter filter = createEventFilter(eventTypes, Collections.singletonList(absPath),
- isDeep, uuid, nodeTypeName, noLocal, false);
+ isDeep, uuid, nodeTypeName, noLocal, false, false);
dispatcher.addConsumer(new EventConsumer(session, listener, filter));
}
@@ -135,7 +135,7 @@
EventFilter f = createEventFilter(filter.getEventTypes(), absPaths,
filter.getIsDeep(), filter.getIdentifiers(), filter.getNodeTypes(),
- filter.getNoLocal(), filter.getNoExternal());
+ filter.getNoLocal(), filter.getNoExternal(), filter.getNoInternal());
dispatcher.addConsumer(new EventConsumer(session, listener, f));
}
@@ -202,6 +202,7 @@
* @param nodeTypeName array of node type names.
* @param noLocal a boolean.
* @param noExternal a boolean.
+ * @param noInternal a boolean.
* @return the event filter with the given restrictions.
* @throws RepositoryException if an error occurs.
*/
@@ -211,7 +212,8 @@
String[] uuid,
String[] nodeTypeName,
boolean noLocal,
- boolean noExternal)
+ boolean noExternal,
+ boolean noInternal)
throws RepositoryException {
// create NodeType instances from names
NodeTypeImpl[] nodeTypes;
@@ -248,7 +250,7 @@
}
// create filter
return new EventFilter(
- session, eventTypes, paths, isDeep, ids, nodeTypes, noLocal, noExternal);
+ session, eventTypes, paths, isDeep, ids, nodeTypes, noLocal, noExternal, noInternal);
}
/**
@@ -280,7 +282,7 @@
}
EventFilter filter = createEventFilter(
- eventTypes, Collections.singletonList(absPath), isDeep, uuid, nodeTypeName, false, false);
+ eventTypes, Collections.singletonList(absPath), isDeep, uuid, nodeTypeName, false, false, false);
return new EventJournalImpl(
filter, clusterNode.getJournal(), clusterNode.getId(), session);
}
Index: jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitEventFilter.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitEventFilter.java (revision eb28325c1fb2eeb7f3fc870b948af2748429a4d2)
+++ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitEventFilter.java (revision )
@@ -72,6 +72,10 @@
* noExternal: if true, then events
* from external cluster nodes are ignored. Otherwise, they are not ignored.
*
+ *
+ * noInternal: if true, then events
+ * from this cluster node are ignored. Otherwise, they are not ignored.
+ *
*
* The restrictions are "ANDed" together. In other words, for a particular node to be "listened to" it
* must meet all the restrictions.
@@ -86,6 +90,7 @@
private boolean noLocal;
private String[] absPaths = new String[]{};
private boolean noExternal;
+ private boolean noInternal;
/**
* Sets the eventTypes parameter of the filter.
@@ -254,4 +259,26 @@
public boolean getNoExternal() {
return noExternal;
}
+
+ /**
+ * Sets the noInternal parameter of the filter.
+ * If left unset, this parameter defaults to false.
+ *
+ * @param noInternal a boolean.
+ * @return This EventFilter object with the noExternal parameter set.
+ */
+ public JackrabbitEventFilter setNoInternal(boolean noInternal) {
+ this.noInternal = noInternal;
+ return this;
+ }
+
+ /**
+ * Returns the noInternal parameter of the filter.
+ *
+ * @return a boolean.
+ */
+ public boolean getNoInternal() {
+ return noInternal;
+ }
+
}
\ No newline at end of file