Search in sources :

Example 1 with ChangeSetFilter

use of org.apache.jackrabbit.oak.plugins.observation.filter.ChangeSetFilter in project jackrabbit-oak by apache.

the class ChangeProcessor method evalPrefilter.

/**
 * Evaluate the prefilter for a given commit.
 * @param changeSet
 *
 * @return a FilterResult indicating either inclusion, exclusion or
 *         inclusion-due-to-skipping. The latter is used to reflect
 *         prefilter evaluation better in statistics (as it could also have
 *         been reported just as include)
 */
private FilterResult evalPrefilter(NodeState root, CommitInfo info, ChangeSet changeSet) {
    if (info == null) {
        return FilterResult.PREFILTERING_SKIPPED;
    }
    if (root == null) {
        // we can't do any diffing etc, so just not exclude it
        return FilterResult.PREFILTERING_SKIPPED;
    }
    final FilterProvider fp = filterProvider.get();
    // FIXME don't rely on toString for session id
    if (!fp.includeCommit(contentSession.toString(), info)) {
        // 'classic' (and cheap pre-) filtering
        return FilterResult.EXCLUDE;
    }
    if (changeSet == null) {
        // go through prefiltering)
        return FilterResult.PREFILTERING_SKIPPED;
    }
    final ChangeSetFilter prefilter = fp;
    if (prefilter.excludes(changeSet)) {
        return FilterResult.EXCLUDE;
    } else {
        return FilterResult.INCLUDE;
    }
}
Also used : ChangeSetFilter(org.apache.jackrabbit.oak.plugins.observation.filter.ChangeSetFilter) FilterProvider(org.apache.jackrabbit.oak.plugins.observation.filter.FilterProvider)

Aggregations

ChangeSetFilter (org.apache.jackrabbit.oak.plugins.observation.filter.ChangeSetFilter)1 FilterProvider (org.apache.jackrabbit.oak.plugins.observation.filter.FilterProvider)1