All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.day.cq.commons.jcr.ObservationUtil Maven / Gradle / Ivy

/*
 * Copyright 1997-2011 Day Management AG
 * Barfuesserplatz 6, 4001 Basel, Switzerland
 * All Rights Reserved.
 *
 * This software is the confidential and proprietary information of
 * Day Management AG, ("Confidential Information"). You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Day.
 */
package com.day.cq.commons.jcr;

import org.apache.jackrabbit.api.observation.JackrabbitEvent;

import javax.jcr.observation.Event;

/**
 * Utility for common JCR Observations
 */
public class ObservationUtil {

    /**
     * On a JCR implementation which supports cluster-aware event processing, checks if the event has originally
     * happened locally (internal) or remotely (external).
     *
     * 

* If the result of this method call is used to filter out external events, the recommended approach is to use one * of the following dedicated APIs: * *

    *
  1. Register observation listeners with a org.apache.jackrabbit.api.observation.JackrabbitEventFilter * and specify setNoExternal(true)
  2. *
  3. Implement the org.apache.jackrabbit.oak.plugins.observation.ExcludeExternal marker interface ( * Oak-only )
  4. *
* * This ensures that external events are not delivered within the cluster only to be filtered away by the receiving * listener. *

* * @param event The event to be checked. * @return true if the JCR implementation is cluster aware and the event is external. */ public static boolean isExternal(Event event) { return (event instanceof JackrabbitEvent) && ((JackrabbitEvent) event).isExternal(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy