Use ResourceId or DiscreteResourceId when specifying a resource
Change-Id: I4e29558ec649510c8d08bb5e5f8ed10c189252e5
diff --git a/core/api/src/main/java/org/onosproject/net/newresource/ResourceService.java b/core/api/src/main/java/org/onosproject/net/newresource/ResourceService.java
index 6dcd7ef..1a2fa2c 100644
--- a/core/api/src/main/java/org/onosproject/net/newresource/ResourceService.java
+++ b/core/api/src/main/java/org/onosproject/net/newresource/ResourceService.java
@@ -129,24 +129,22 @@
/**
* Returns resource allocations of the specified resource.
*
- * @param resource resource to check the allocation
+ * @param id ID of the resource to check the allocation
* @return list of allocation information.
* If the resource is not allocated, the return value is an empty list.
*/
- // TODO: need to change the argument type to ResourceId
- List<ResourceAllocation> getResourceAllocations(Resource resource);
+ List<ResourceAllocation> getResourceAllocations(ResourceId id);
/**
* Returns allocated resources being as children of the specified parent and being the specified resource type.
*
- * @param parent parent resource
+ * @param parent parent resource ID
* @param cls class to specify a type of resource
* @param <T> type of the resource
* @return non-empty collection of resource allocations if resources are allocated with the subject and type,
* empty collection if no resource is allocated with the subject and type
*/
- // TODO: might need to change the first argument type to ResourceId or ResourceId.Discrete
- <T> Collection<ResourceAllocation> getResourceAllocations(Resource parent, Class<T> cls);
+ <T> Collection<ResourceAllocation> getResourceAllocations(DiscreteResourceId parent, Class<T> cls);
/**
* Returns resources allocated to the specified consumer.
@@ -159,20 +157,18 @@
/**
* Returns resources that point available child resources under the specified resource.
*
- * @param parent parent resource
+ * @param parent parent resource ID
* @return available resources under the specified resource
*/
- // TODO: need to change the argument type to ResourceId or ResourceId.Discrete
- Set<Resource> getAvailableResources(Resource parent);
+ Set<Resource> getAvailableResources(DiscreteResourceId parent);
/**
* Returns resources registered under the specified resource.
*
- * @param parent parent resource
+ * @param parent parent resource ID
* @return registered resources under the specified resource
*/
- // TODO: need to change the argument type to ResourceId or ResourceId.Discrete
- Set<Resource> getRegisteredResources(Resource parent);
+ Set<Resource> getRegisteredResources(DiscreteResourceId parent);
/**
diff --git a/core/api/src/main/java/org/onosproject/net/newresource/ResourceStore.java b/core/api/src/main/java/org/onosproject/net/newresource/ResourceStore.java
index cca8ed0..0e3eee8 100644
--- a/core/api/src/main/java/org/onosproject/net/newresource/ResourceStore.java
+++ b/core/api/src/main/java/org/onosproject/net/newresource/ResourceStore.java
@@ -81,12 +81,11 @@
* The return value is a list having only one element when the given resource is discrete type.
* The return value may have multiple elements when the given resource is continuous type.
*
- * @param resource resource whose allocated consumer to be returned
+ * @param id ID of the resource whose allocated consumer to be returned
* @return resource consumers who are allocated the resource.
* Returns empty list if there is no such consumer.
*/
- // TODO: need to change the argument type to ResourceId
- List<ResourceConsumer> getConsumers(Resource resource);
+ List<ResourceAllocation> getResourceAllocations(ResourceId id);
/**
* Returns the availability of the specified resource.
@@ -107,22 +106,20 @@
/**
* Returns a set of the child resources of the specified parent.
*
- * @param parent parent of the resource to be returned
+ * @param parent ID of the parent of the resource to be returned
* @return a set of the child resources of the specified resource
*/
- // TODO: need to change the argument type to ResourceId or ResourceId.Discrete
- Set<Resource> getChildResources(Resource parent);
+ Set<Resource> getChildResources(DiscreteResourceId parent);
/**
* Returns a collection of the resources which are children of the specified parent and
* whose type is the specified class.
*
- * @param parent parent of the resources to be returned
+ * @param parent ID of the parent of the resources to be returned
* @param cls class instance of the children
* @param <T> type of the resource
* @return a collection of the resources which belongs to the specified subject and
* whose type is the specified class.
*/
- // TODO: need to change the argument type to ResourceId or ResourceId.Discrete
- <T> Collection<Resource> getAllocatedResources(Resource parent, Class<T> cls);
+ <T> Collection<Resource> getAllocatedResources(DiscreteResourceId parent, Class<T> cls);
}