blob: d394e1ceb26dfee39cf40a2df6bcbd05e303c275 [file] [log] [blame]
Sho SHIMIZU70ee1ee2015-08-06 11:11:52 -07001/*
2 * Copyright 2015 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 */
16package org.onosproject.net.newresource;
17
18import com.google.common.annotations.Beta;
Sho SHIMIZU2c7cecf2015-11-11 14:16:14 -080019import com.google.common.collect.ImmutableList;
Sho SHIMIZU70ee1ee2015-08-06 11:11:52 -070020
Sho SHIMIZUba41fc12015-08-12 15:43:22 -070021import java.util.List;
Sho SHIMIZU70ee1ee2015-08-06 11:11:52 -070022
23/**
24 * Service for administering resource service behavior.
25 */
26@Beta
27public interface ResourceAdminService {
28 /**
Sho SHIMIZU2c7cecf2015-11-11 14:16:14 -080029 * Registers the specified resources.
Sho SHIMIZU70ee1ee2015-08-06 11:11:52 -070030 *
Sho SHIMIZU2c7cecf2015-11-11 14:16:14 -080031 * @param resources resources to be registered
Sho SHIMIZUba41fc12015-08-12 15:43:22 -070032 * @return true if registration is successfully done, false otherwise. Registration
33 * succeeds when each resource is not registered or unallocated.
Sho SHIMIZU70ee1ee2015-08-06 11:11:52 -070034 */
Sho SHIMIZU7b326972016-02-09 15:53:39 -080035 default boolean register(Resource... resources) {
36 return register(ImmutableList.copyOf(resources));
Sho SHIMIZUba41fc12015-08-12 15:43:22 -070037 }
38
39 /**
Sho SHIMIZU2c7cecf2015-11-11 14:16:14 -080040 * Registers the specified resources.
Sho SHIMIZUba41fc12015-08-12 15:43:22 -070041 *
Sho SHIMIZU2c7cecf2015-11-11 14:16:14 -080042 * @param resources resources to be registered
Sho SHIMIZUba41fc12015-08-12 15:43:22 -070043 * @return true if registration is successfully done, false otherwise. Registration
44 * succeeds when each resource is not registered or unallocated.
45 */
Jonathan Hart56151262016-02-11 09:48:50 -080046 boolean register(List<Resource> resources);
Sho SHIMIZU2d8a13a2015-08-18 22:37:41 -070047
48 /**
Sho SHIMIZU2c7cecf2015-11-11 14:16:14 -080049 * Unregisters the specified resources.
Sho SHIMIZU2d8a13a2015-08-18 22:37:41 -070050 *
Sho SHIMIZU72f81b12016-02-09 09:26:17 -080051 * @param ids IDs of resources to be unregistered
Sho SHIMIZU2d8a13a2015-08-18 22:37:41 -070052 * @return true if unregistration is successfully done, false otherwise. Unregistration
53 * succeeds when each resource is not registered or unallocated.
54 */
Sho SHIMIZU7b326972016-02-09 15:53:39 -080055 default boolean unregister(ResourceId... ids) {
56 return unregister(ImmutableList.copyOf(ids));
Sho SHIMIZU2d8a13a2015-08-18 22:37:41 -070057 }
58
59 /**
Sho SHIMIZU2c7cecf2015-11-11 14:16:14 -080060 * Unregisters the specified resources.
Sho SHIMIZU2d8a13a2015-08-18 22:37:41 -070061 *
Sho SHIMIZU72f81b12016-02-09 09:26:17 -080062 * @param ids IDs of resources to be unregistered
Sho SHIMIZU2d8a13a2015-08-18 22:37:41 -070063 * @return true if unregistration is successfully done, false otherwise. Unregistration
64 * succeeds when each resource is not registered or unallocated.
65 */
Jonathan Hart56151262016-02-11 09:48:50 -080066 boolean unregister(List<ResourceId> ids);
Sho SHIMIZU70ee1ee2015-08-06 11:11:52 -070067}