<commit_before>/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.observation.event;

import java.util.List;

import javax.inject.Inject;

import org.xwiki.observation.AbstractEventListener;
import org.xwiki.observation.ObservationManager;
import org.xwiki.observation.remote.RemoteObservationManagerContext;
import org.xwiki.stability.Unstable;

/**
 * This is a version of an {@link AbstractEventListener} that skips automatically all events that are remote:
 * only local events will be processed. This abstraction should be preferred over {@link AbstractEventListener} when
 * the remote events should be ignored.
 *
 * @version $Id$
 * @since 14.4RC1
 */
@Unstable
public abstract class AbstractLocalEventListener extends AbstractEventListener
{
    @Inject
    protected RemoteObservationManagerContext remoteObservationManagerContext;

    /**
     * @param name the listener's name. It's a free form text identifying this listener instance in a unique manner.
     *            This name is used for some operations in {@link ObservationManager}.
     * @param events the list of events this listener is configured to receive. This listener will be automatically
     *            registered with this list of events against the {@link ObservationManager}. When an event occurs, for
     *            each matching event in this list, the {@link #onEvent(Event, Object, Object)} method will be called.
     */<commit_msg>XWIKI-19693: Provide a listener abstraction to process only local events<commit_after>/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.observation.event;

import java.util.List;

import javax.inject.Inject;

import org.xwiki.observation.AbstractEventListener;
import org.xwiki.observation.ObservationManager;
import org.xwiki.observation.remote.RemoteObservationManagerContext;
import org.xwiki.stability.Unstable;

/**
 * This is a version of an {@link AbstractEventListener} that skips automatically all events that are remote:
 * only local events will be processed. This abstraction should be preferred over {@link AbstractEventListener} when
 * the remote events should be ignored.
 *
 * @version $Id$
 * @since 14.4RC1
 * @since 13.10.7
 */
@Unstable
public abstract class AbstractLocalEventListener extends AbstractEventListener
{
    @Inject
    protected RemoteObservationManagerContext remoteObservationManagerContext;

    /**
     * @param name the listener's name. It's a free form text identifying this listener instance in a unique manner.
     *            This name is used for some operations in {@link ObservationManager}.
     * @param events the list of events this listener is configured to receive. This listener will be automatically
     *            registered with this list of events against the {@link ObservationManager}. When an event occurs, for
     *            each matching event in this list, the {@link #onEvent(Event, Object, Object)} method will be called.
     */
{'fraction_non_alphanumeric': 0.06398969293536612, 'fraction_numerical': 0.009448142581060769, 'mean_word_length': 3.939554612937434, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4270415', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1110, 'n_words': 565}