Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
EventListener | 33 | 0 | - | 0 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.observation; | |
21 | ||
22 | import java.util.List; | |
23 | ||
24 | import org.xwiki.component.annotation.Role; | |
25 | import org.xwiki.observation.event.Event; | |
26 | ||
27 | /** | |
28 | * Components wanting to receive Observation {@link Event events} must implement this interface. | |
29 | * | |
30 | * @version $Id: e892b7f0786dc86deba2a962aeacbcf8a140c6b5 $ | |
31 | */ | |
32 | @Role | |
33 | public interface EventListener | |
34 | { | |
35 | /** | |
36 | * @return the listener's name. It's a free form text identifying this listener instance in a unique manner. This | |
37 | * name is used for some operations in {@link ObservationManager}. | |
38 | */ | |
39 | String getName(); | |
40 | ||
41 | /** | |
42 | * @return the list of events this listener is configured to receive. This listener will be automatically registered | |
43 | * with this list of events against the {@link ObservationManager}. When an event occurs, for each matching | |
44 | * event in this list, the {@link #onEvent(Event, Object, Object)} method will be called. | |
45 | */ | |
46 | List<Event> getEvents(); | |
47 | ||
48 | /** | |
49 | * The {@link org.xwiki.observation.ObservationManager} calls this method when an event matches one of the events | |
50 | * for which this listener is registered (see {@link #getEvents()}. | |
51 | * | |
52 | * @param event the event triggered. Can be used to differentiate different events if your Object supports several | |
53 | * events for example. | |
54 | * @param source the event source i.e. the object for which the event was triggered. For example this would be the | |
55 | * document Object if the event is a document update event. | |
56 | * @param data some additional and optional data passed that can be acted on. | |
57 | */ | |
58 | void onEvent(Event event, Object source, Object data); | |
59 | } |