blob: 8240139f71dd41fec92279cc3869240278b4fbee [file] [log] [blame]
Yoonseon Han32aae2e2016-10-11 16:46:04 -07001/*
2 * Copyright 2016-present 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 */
16
17package org.onosproject.incubator.net.virtual.provider;
18
19import java.util.Set;
20
21/** Registry for tracking information virtual providers with the core.
22 * @param <P> type of the information virtual provider
23 * @param <S> type of the provider virtual service
24 */
25
26public interface VirtualProviderRegistry<P extends VirtualProvider,
27 S extends VirtualProviderService<P>> {
28
29 /**
30 * Registers the supplied virtual provider with the virtual core.
31 *
32 * @param provider virtual provider to be registered
33 * @return service for injecting information into core
34 * @throws java.lang.IllegalArgumentException if the provider is registered already
35 */
36 S register(P provider);
37
38 /**
39 * Unregisters the supplied virtual provider.
40 * As a result the previously issued virtual provider service
41 * will be invalidated and any subsequent invocations
42 * of its methods may throw {@link java.lang.IllegalStateException}.
43 * Unregistering a virtual provider that has not been previously registered
44 * result in a no-op.
45 *
46 * @param provider provider to be unregistered
47 */
48 void unregister(P provider);
49
50 /**
51 * Returns a set of currently registered virtual providers.
52 *
53 * @return set of virtual providers
54 */
55 Set<P> getProviders();
56}