blob: 8cab8a85443d54b5338a0483510b616aff2a6233 [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 */
tomc1a38d32014-08-25 23:01:32 -070016package org.onlab.onos.net.provider;
tom0eb04ca2014-08-25 14:34:51 -070017
tom132b58a2014-08-28 16:11:28 -070018import java.util.Set;
19
tom0eb04ca2014-08-25 14:34:51 -070020/**
tom96dfcab2014-08-28 09:26:03 -070021 * Registry for tracking information providers with the core.
tom0eb04ca2014-08-25 14:34:51 -070022 *
tom64b7aac2014-08-26 00:18:21 -070023 * @param <P> type of the information provider
tom0eb04ca2014-08-25 14:34:51 -070024 * @param <S> type of the provider service
25 */
tom96dfcab2014-08-28 09:26:03 -070026public interface ProviderRegistry<P extends Provider, S extends ProviderService<P>> {
tom0eb04ca2014-08-25 14:34:51 -070027
28 /**
29 * Registers the supplied provider with the core.
30 *
31 * @param provider provider to be registered
32 * @return provider service for injecting information into core
tomb1260e42014-08-26 18:39:57 -070033 * @throws java.lang.IllegalArgumentException if the provider is registered already
tom0eb04ca2014-08-25 14:34:51 -070034 */
tom64b7aac2014-08-26 00:18:21 -070035 S register(P provider);
tom0eb04ca2014-08-25 14:34:51 -070036
37 /**
38 * Unregisters the supplied provider. As a result the previously issued
tom64b7aac2014-08-26 00:18:21 -070039 * provider service will be invalidated and any subsequent invocations
40 * of its methods may throw {@link java.lang.IllegalStateException}.
Thomas Vachuska4b420772014-10-30 16:46:17 -070041 * <p>
tomb1260e42014-08-26 18:39:57 -070042 * Unregistering a provider that has not been previously registered results
43 * in a no-op.
Thomas Vachuska4b420772014-10-30 16:46:17 -070044 * </p>
tom0eb04ca2014-08-25 14:34:51 -070045 *
46 * @param provider provider to be unregistered
47 */
tom64b7aac2014-08-26 00:18:21 -070048 void unregister(P provider);
tom0eb04ca2014-08-25 14:34:51 -070049
tom132b58a2014-08-28 16:11:28 -070050 /**
51 * Returns a set of currently registered provider identities.
52 *
53 * @return set of provider identifiers
54 */
55 Set<ProviderId> getProviders();
56
tom0eb04ca2014-08-25 14:34:51 -070057}