HIGUCHI Yuta
Committed by Gerrit Code Review

Add resource API to query registered resource

Change-Id: Ibf53a0fa383043d17e78578093eb3055631796d0
......@@ -162,6 +162,15 @@ public interface ResourceService extends ListenerService<ResourceEvent, Resource
Collection<Resource> getAvailableResources(Resource parent);
/**
* Returns resources registered under the specified resource.
*
* @param parent parent resource
* @return registered resources under the specified resource
*/
Collection<Resource> getRegisteredResources(Resource parent);
/**
* Returns the availability of the specified resource.
*
* @param resource resource to check the availability
......
......@@ -158,6 +158,13 @@ public final class ResourceManager extends AbstractListenerManager<ResourceEvent
}
@Override
public Collection<Resource> getRegisteredResources(Resource parent) {
checkNotNull(parent);
return store.getChildResources(parent);
}
@Override
public boolean isAvailable(Resource resource) {
checkNotNull(resource);
......
......@@ -101,6 +101,11 @@ class MockResourceService implements ResourceService {
}
@Override
public Collection<Resource> getRegisteredResources(Resource parent) {
return getAvailableResources(parent);
}
@Override
public boolean isAvailable(Resource resource) {
return true;
}
......