Package org.onosproject.net.resource
Interface ResourceQueryService
-
- All Known Subinterfaces:
ResourceService
public interface ResourceQueryService
Service for retrieving resource information.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Set<Resource>
getAvailableResources(DiscreteResourceId parent)
Returns resources that point available child resources under the specified resource.<T> Set<Resource>
getAvailableResources(DiscreteResourceId parent, Class<T> cls)
Returns available resources which are child resources of the specified parent and whose type is the specified type.<T> Set<T>
getAvailableResourceValues(DiscreteResourceId parent, Class<T> cls)
Returns available resource values which are the values of the child resource of the specified parent and whose type is the specified type.Set<Resource>
getRegisteredResources(DiscreteResourceId parent)
Returns resources registered under the specified resource.<T> Collection<ResourceAllocation>
getResourceAllocations(DiscreteResourceId parent, Class<T> cls)
Returns allocated resources being as children of the specified parent and being the specified resource type.Collection<ResourceAllocation>
getResourceAllocations(ResourceConsumer consumer)
Returns resources allocated to the specified consumer.List<ResourceAllocation>
getResourceAllocations(ResourceId id)
Returns resource allocations of the specified resource.boolean
isAvailable(Resource resource)
Returns the availability of the specified resource.
-
-
-
Method Detail
-
getResourceAllocations
List<ResourceAllocation> getResourceAllocations(ResourceId id)
Returns resource allocations of the specified resource.- Parameters:
id
- ID of the resource to check the allocation- Returns:
- list of allocation information. If the resource is not allocated, the return value is an empty list.
-
getResourceAllocations
<T> Collection<ResourceAllocation> getResourceAllocations(DiscreteResourceId parent, Class<T> cls)
Returns allocated resources being as children of the specified parent and being the specified resource type.- Type Parameters:
T
- type of the resource- Parameters:
parent
- parent resource IDcls
- class to specify a type of resource- Returns:
- 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
-
getResourceAllocations
Collection<ResourceAllocation> getResourceAllocations(ResourceConsumer consumer)
Returns resources allocated to the specified consumer.- Parameters:
consumer
- consumer whose allocated resources are to be returned- Returns:
- resources allocated to the consumer
-
getAvailableResources
Set<Resource> getAvailableResources(DiscreteResourceId parent)
Returns resources that point available child resources under the specified resource.- Parameters:
parent
- parent resource ID- Returns:
- available resources under the specified resource
-
getAvailableResources
<T> Set<Resource> getAvailableResources(DiscreteResourceId parent, Class<T> cls)
Returns available resources which are child resources of the specified parent and whose type is the specified type.- Type Parameters:
T
- type of the resource- Parameters:
parent
- parent resource IDcls
- class to specify a type of resource- Returns:
- available resources of the specified type under the specified parent resource
-
getAvailableResourceValues
<T> Set<T> getAvailableResourceValues(DiscreteResourceId parent, Class<T> cls)
Returns available resource values which are the values of the child resource of the specified parent and whose type is the specified type.- Type Parameters:
T
- type of the resource- Parameters:
parent
- parent resource IDcls
- class to specify a type of resource- Returns:
- available resource value of the specified type under the specified parent resource
-
getRegisteredResources
Set<Resource> getRegisteredResources(DiscreteResourceId parent)
Returns resources registered under the specified resource.- Parameters:
parent
- parent resource ID- Returns:
- registered resources under the specified resource
-
isAvailable
boolean isAvailable(Resource resource)
Returns the availability of the specified resource.- Parameters:
resource
- resource to check the availability- Returns:
- true if available, otherwise false
-
-