commit | e7f4f3f1c3ecf331d542fafa22f982242ec5e316 | [log] [tgz] |
---|---|---|
author | Sho SHIMIZU <sshimizu@us.fujitsu.com> | Tue Oct 13 16:27:25 2015 -0700 |
committer | Ray Milkey <ray@onlab.us> | Thu Oct 29 09:01:54 2015 -0700 |
tree | 7eb9a64b63aba0f028f42c4399267dad5e320b50 | |
parent | 0e99e2ba4082099e560939faa821aa3513092993 [diff] [blame] |
Define and implement a method to query available resources Change-Id: I49fbcdf215e402603ea15f469d41e572f1cce1c6
diff --git a/core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceManager.java b/core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceManager.java index a27ce67..10fe75e 100644 --- a/core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceManager.java +++ b/core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceManager.java
@@ -127,6 +127,17 @@ } @Override + public Collection<ResourcePath> getAvailableResources(ResourcePath parent) { + checkNotNull(parent); + + Collection<ResourcePath> children = store.getChildResources(parent); + return children.stream() + // We access store twice in this method, then the store may be updated by others + .filter(x -> !store.getConsumer(x).isPresent()) + .collect(Collectors.toList()); + } + + @Override public boolean isAvailable(ResourcePath resource) { checkNotNull(resource);