blob: 08975e213df3353bb3c72591021bd372d3281d58 [file] [log] [blame]
tomc1a38d32014-08-25 23:01:32 -07001package org.onlab.onos.net.provider;
tom0eb04ca2014-08-25 14:34:51 -07002
tom132b58a2014-08-28 16:11:28 -07003import java.util.Set;
4
tom0eb04ca2014-08-25 14:34:51 -07005/**
tom96dfcab2014-08-28 09:26:03 -07006 * Registry for tracking information providers with the core.
tom0eb04ca2014-08-25 14:34:51 -07007 *
tom64b7aac2014-08-26 00:18:21 -07008 * @param <P> type of the information provider
tom0eb04ca2014-08-25 14:34:51 -07009 * @param <S> type of the provider service
10 */
tom96dfcab2014-08-28 09:26:03 -070011public interface ProviderRegistry<P extends Provider, S extends ProviderService<P>> {
tom0eb04ca2014-08-25 14:34:51 -070012
13 /**
14 * Registers the supplied provider with the core.
15 *
16 * @param provider provider to be registered
17 * @return provider service for injecting information into core
tomb1260e42014-08-26 18:39:57 -070018 * @throws java.lang.IllegalArgumentException if the provider is registered already
tom0eb04ca2014-08-25 14:34:51 -070019 */
tom64b7aac2014-08-26 00:18:21 -070020 S register(P provider);
tom0eb04ca2014-08-25 14:34:51 -070021
22 /**
23 * Unregisters the supplied provider. As a result the previously issued
tom64b7aac2014-08-26 00:18:21 -070024 * provider service will be invalidated and any subsequent invocations
25 * of its methods may throw {@link java.lang.IllegalStateException}.
tomb1260e42014-08-26 18:39:57 -070026 * <p/>
27 * Unregistering a provider that has not been previously registered results
28 * in a no-op.
tom0eb04ca2014-08-25 14:34:51 -070029 *
30 * @param provider provider to be unregistered
31 */
tom64b7aac2014-08-26 00:18:21 -070032 void unregister(P provider);
tom0eb04ca2014-08-25 14:34:51 -070033
tom132b58a2014-08-28 16:11:28 -070034 /**
35 * Returns a set of currently registered provider identities.
36 *
37 * @return set of provider identifiers
38 */
39 Set<ProviderId> getProviders();
40
tom0eb04ca2014-08-25 14:34:51 -070041}