ONOS-2446: Implement API to declare resource hierarchy
Remove API to define resource boundary
(ResourceAdminService.defineResourceBoundary) to integrate with API for
resource hierarchy
Change-Id: Iffa28dec16320122fe41f4f455000596fa266acb
diff --git a/core/api/src/main/java/org/onosproject/net/newresource/ResourceAdminService.java b/core/api/src/main/java/org/onosproject/net/newresource/ResourceAdminService.java
index 5fcb132..1a13c32 100644
--- a/core/api/src/main/java/org/onosproject/net/newresource/ResourceAdminService.java
+++ b/core/api/src/main/java/org/onosproject/net/newresource/ResourceAdminService.java
@@ -17,7 +17,8 @@
import com.google.common.annotations.Beta;
-import java.util.function.Predicate;
+import java.util.Arrays;
+import java.util.List;
/**
* Service for administering resource service behavior.
@@ -25,13 +26,26 @@
@Beta
public interface ResourceAdminService {
/**
- * Define a boundary of the resource specified by the class.
- * The specified predicate is expected to return true if the supplied value is
- * in the resource boundary and return false if it is out of the boundary.
+ * Register resources as the children of the parent resource path.
*
- * @param cls class of the resource type
- * @param predicate predicate returning true if the value is in the boundary
- * @param <T> type of the resource
+ * @param parent parent resource path under which the resource are registered
+ * @param children resources to be registered as the children of the parent
+ * @param <T> type of resources
+ * @return true if registration is successfully done, false otherwise. Registration
+ * succeeds when each resource is not registered or unallocated.
*/
- <T> void defineResourceBoundary(Class<T> cls, Predicate<T> predicate);
+ default <T> boolean registerResources(ResourcePath parent, T... children) {
+ return registerResources(parent, Arrays.asList(children));
+ }
+
+ /**
+ * Register resources as the children of the parent resource path.
+ *
+ * @param parent parent resource path under which the resource are registered
+ * @param children resources to be registered as the children of the parent
+ * @param <T> type of resources
+ * @return true if registration is successfully done, false otherwise. Registration
+ * succeeds when each resource is not registered or unallocated.
+ */
+ <T> boolean registerResources(ResourcePath parent, List<T> children);
}