blob: 40c720a202c55a15d6b7bcd43e88a3bc014e2ec8 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
2 * Copyright 2014 Open Networking Laboratory
3 *
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 */
tomd7356722014-08-26 01:07:39 -070016package org.onlab.onos.event;
17
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}