@Beta public interface ResourceStore extends Store<ResourceEvent,ResourceStoreDelegate>
Modifier and Type | Method and Description |
---|---|
boolean |
allocate(java.util.List<? extends Resource> resources,
ResourceConsumer consumer)
Allocates the specified resources to the specified consumer in transactional way.
|
<T> java.util.Collection<Resource> |
getAllocatedResources(DiscreteResourceId parent,
java.lang.Class<T> cls)
Returns a collection of the resources which are children of the specified parent and
whose type is the specified class.
|
java.util.Set<Resource> |
getChildResources(DiscreteResourceId parent)
Returns a set of the child resources of the specified parent.
|
<T> java.util.Set<Resource> |
getChildResources(DiscreteResourceId parent,
java.lang.Class<T> cls)
Returns a set of the child resources of the specified parent and whose type is
the specified class.
|
java.util.List<ResourceAllocation> |
getResourceAllocations(ResourceId id)
Returns the resource consumers to whom the specified resource is allocated.
|
java.util.Collection<Resource> |
getResources(ResourceConsumer consumer)
Returns a collection of the resources allocated to the specified consumer.
|
boolean |
isAvailable(Resource resource)
Returns the availability of the specified resource.
|
boolean |
register(java.util.List<? extends Resource> resources)
Registers the resources in transactional way.
|
boolean |
release(java.util.List<ResourceAllocation> allocations)
Releases the specified allocated resources in transactional way.
|
boolean |
unregister(java.util.List<? extends ResourceId> ids)
Unregisters the resources in transactional way.
|
hasDelegate, setDelegate, unsetDelegate
boolean register(java.util.List<? extends Resource> resources)
resources
- resources to be registeredboolean unregister(java.util.List<? extends ResourceId> ids)
ids
- resources to be unregisteredboolean allocate(java.util.List<? extends Resource> resources, ResourceConsumer consumer)
resources
- resources to be allocatedconsumer
- resource consumer which the resources are allocated toboolean release(java.util.List<ResourceAllocation> allocations)
allocations
- allocaitons to be releasedjava.util.List<ResourceAllocation> getResourceAllocations(ResourceId id)
id
- ID of the resource whose allocated consumer to be returnedboolean isAvailable(Resource resource)
resource
- resource to check the availabilityjava.util.Collection<Resource> getResources(ResourceConsumer consumer)
consumer
- resource consumer whose allocated resource are searched forjava.util.Set<Resource> getChildResources(DiscreteResourceId parent)
parent
- ID of the parent of the resource to be returned<T> java.util.Set<Resource> getChildResources(DiscreteResourceId parent, java.lang.Class<T> cls)
T
- type of the resourceparent
- ID of the parent of the resources to be returnedcls
- class instance of the children<T> java.util.Collection<Resource> getAllocatedResources(DiscreteResourceId parent, java.lang.Class<T> cls)
T
- type of the resourceparent
- ID of the parent of the resources to be returnedcls
- class instance of the children