blob: 4683b741ad625a0e5bba2c4d6b4c847bbcefb2d0 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2014-present Open Networking Laboratory
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.event;
tomd7356722014-08-26 01:07:39 -070017
18import java.util.Set;
19
20/**
tom96dfcab2014-08-28 09:26:03 -070021 * Abstraction of an event sink registry capable of tracking sinks based on
tomd7356722014-08-26 01:07:39 -070022 * their event class.
23 */
tom96dfcab2014-08-28 09:26:03 -070024public interface EventSinkRegistry {
tomd7356722014-08-26 01:07:39 -070025
26 /**
27 * Adds the specified sink for the given event class.
28 *
29 * @param eventClass event class
30 * @param sink event sink
31 * @param <E> type of event
32 */
33 <E extends Event> void addSink(Class<E> eventClass, EventSink<E> sink);
34
35 /**
36 * Removes the sink associated with the given event class.
37 *
38 * @param eventClass event class
39 * @param <E> type of event
40 */
41 <E extends Event> void removeSink(Class<E> eventClass);
42
43 /**
44 * Returns the event sink associated with the specified event class.
45 *
46 * @param eventClass event class
47 * @param <E> type of event
48 * @return event sink or null if none found
49 */
50 <E extends Event> EventSink<E> getSink(Class<E> eventClass);
51
52 /**
53 * Returns the set of all event classes for which sinks are presently
54 * registered.
55 *
56 * @return set of event classes
57 */
58 Set<Class<? extends Event>> getSinks();
59
60}