Sho SHIMIZU | 70ee1ee | 2015-08-06 11:11:52 -0700 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.net.newresource; |
| 17 | |
| 18 | import com.google.common.annotations.Beta; |
| 19 | |
Sho SHIMIZU | ba41fc1 | 2015-08-12 15:43:22 -0700 | [diff] [blame^] | 20 | import java.util.Arrays; |
| 21 | import java.util.List; |
Sho SHIMIZU | 70ee1ee | 2015-08-06 11:11:52 -0700 | [diff] [blame] | 22 | |
| 23 | /** |
| 24 | * Service for administering resource service behavior. |
| 25 | */ |
| 26 | @Beta |
| 27 | public interface ResourceAdminService { |
| 28 | /** |
Sho SHIMIZU | ba41fc1 | 2015-08-12 15:43:22 -0700 | [diff] [blame^] | 29 | * Register resources as the children of the parent resource path. |
Sho SHIMIZU | 70ee1ee | 2015-08-06 11:11:52 -0700 | [diff] [blame] | 30 | * |
Sho SHIMIZU | ba41fc1 | 2015-08-12 15:43:22 -0700 | [diff] [blame^] | 31 | * @param parent parent resource path under which the resource are registered |
| 32 | * @param children resources to be registered as the children of the parent |
| 33 | * @param <T> type of resources |
| 34 | * @return true if registration is successfully done, false otherwise. Registration |
| 35 | * succeeds when each resource is not registered or unallocated. |
Sho SHIMIZU | 70ee1ee | 2015-08-06 11:11:52 -0700 | [diff] [blame] | 36 | */ |
Sho SHIMIZU | ba41fc1 | 2015-08-12 15:43:22 -0700 | [diff] [blame^] | 37 | default <T> boolean registerResources(ResourcePath parent, T... children) { |
| 38 | return registerResources(parent, Arrays.asList(children)); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Register resources as the children of the parent resource path. |
| 43 | * |
| 44 | * @param parent parent resource path under which the resource are registered |
| 45 | * @param children resources to be registered as the children of the parent |
| 46 | * @param <T> type of resources |
| 47 | * @return true if registration is successfully done, false otherwise. Registration |
| 48 | * succeeds when each resource is not registered or unallocated. |
| 49 | */ |
| 50 | <T> boolean registerResources(ResourcePath parent, List<T> children); |
Sho SHIMIZU | 70ee1ee | 2015-08-06 11:11:52 -0700 | [diff] [blame] | 51 | } |