Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2014-present Open Networking Foundation |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.event; |
tom | d735672 | 2014-08-26 01:07:39 -0700 | [diff] [blame] | 17 | |
| 18 | import java.util.Set; |
| 19 | |
| 20 | /** |
tom | 96dfcab | 2014-08-28 09:26:03 -0700 | [diff] [blame] | 21 | * Abstraction of an event sink registry capable of tracking sinks based on |
tom | d735672 | 2014-08-26 01:07:39 -0700 | [diff] [blame] | 22 | * their event class. |
| 23 | */ |
tom | 96dfcab | 2014-08-28 09:26:03 -0700 | [diff] [blame] | 24 | public interface EventSinkRegistry { |
tom | d735672 | 2014-08-26 01:07:39 -0700 | [diff] [blame] | 25 | |
| 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 | } |