blob: 1a13c32f7a19b9a9eedb03b04bddca180659f416 [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;
19
Sho SHIMIZUba41fc12015-08-12 15:43:22 -070020import java.util.Arrays;
21import 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 SHIMIZUba41fc12015-08-12 15:43:22 -070029 * Register resources as the children of the parent resource path.
Sho SHIMIZU70ee1ee2015-08-06 11:11:52 -070030 *
Sho SHIMIZUba41fc12015-08-12 15:43:22 -070031 * @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 SHIMIZU70ee1ee2015-08-06 11:11:52 -070036 */
Sho SHIMIZUba41fc12015-08-12 15:43:22 -070037 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 SHIMIZU70ee1ee2015-08-06 11:11:52 -070051}