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