Generalize the methods in ResourceAdminService
Change-Id: Ib78d2ec441651c3215c422ba4b46d726158de4a9
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 1c6930b..3014951 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
@@ -17,7 +17,6 @@
import com.google.common.annotations.Beta;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -41,7 +40,6 @@
import java.util.Optional;
import java.util.stream.Collectors;
-import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
/**
@@ -164,23 +162,17 @@
}
@Override
- public <T> boolean registerResources(ResourcePath parent, List<T> children) {
- checkNotNull(parent);
- checkNotNull(children);
- checkArgument(!children.isEmpty());
+ public boolean registerResources(List<ResourcePath> resources) {
+ checkNotNull(resources);
- List<ResourcePath> resources = Lists.transform(children, parent::child);
return store.register(resources);
}
@Override
- public <T> boolean unregisterResources(ResourcePath parent, List<T> children) {
- checkNotNull(parent);
- checkNotNull(children);
- checkArgument(!children.isEmpty());
+ public boolean unregisterResources(List<ResourcePath> resources) {
+ checkNotNull(resources);
- List<ResourcePath> resources = Lists.transform(children, parent::child);
- return store.unregister(resources);
+ return store.register(resources);
}
private class InternalStoreDelegate implements ResourceStoreDelegate {