summaryrefslogtreecommitdiffstats
path: root/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r
diff options
context:
space:
mode:
Diffstat (limited to 'v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r')
-rw-r--r--v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/ReaderRegistry.java12
-rw-r--r--v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/util/DelegatingReaderRegistry.java13
2 files changed, 15 insertions, 10 deletions
diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/ReaderRegistry.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/ReaderRegistry.java
index 49705fe3b..8c592a699 100644
--- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/ReaderRegistry.java
+++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/ReaderRegistry.java
@@ -17,19 +17,23 @@
package io.fd.honeycomb.v3po.impl.trans.r;
import com.google.common.annotations.Beta;
-import java.util.List;
+import com.google.common.collect.Multimap;
import javax.annotation.Nonnull;
import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
- * Simple delegating reader suitable as a holder for all other root readers, providing readAll feature
+ * Simple delegating reader suitable as a holder for all other root readers, providing readAll feature.
*/
@Beta
public interface ReaderRegistry extends VppReader<DataObject> {
/**
- * Perform read on all underlying readers and merge the results into a single list
+ * Performs read on all registered root readers and merges the results into a Multimap.
+ * Keys represent identifiers for root DataObjects from the data tree modeled by YANG.
+ *
+ * @return multimap that preserves deterministic iteration order across non-distinct key values
*/
@Nonnull
- List<? extends DataObject> readAll();
+ Multimap<InstanceIdentifier<? extends DataObject>, ? extends DataObject> readAll();
}
diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/util/DelegatingReaderRegistry.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/util/DelegatingReaderRegistry.java
index 033e01b09..4e50e5aa8 100644
--- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/util/DelegatingReaderRegistry.java
+++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/trans/r/util/DelegatingReaderRegistry.java
@@ -19,10 +19,11 @@ package io.fd.honeycomb.v3po.impl.trans.r.util;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.collect.Iterables;
-import io.fd.honeycomb.v3po.impl.trans.util.VppRWUtils;
+import com.google.common.collect.LinkedListMultimap;
+import com.google.common.collect.Multimap;
import io.fd.honeycomb.v3po.impl.trans.r.ReaderRegistry;
import io.fd.honeycomb.v3po.impl.trans.r.VppReader;
-import java.util.ArrayList;
+import io.fd.honeycomb.v3po.impl.trans.util.VppRWUtils;
import java.util.List;
import java.util.Map;
import javax.annotation.Nonnull;
@@ -54,15 +55,15 @@ public final class DelegatingReaderRegistry implements ReaderRegistry {
@Override
@Nonnull
- public List<? extends DataObject> readAll() {
- LOG.debug("Reading from all delegates");
+ public Multimap<InstanceIdentifier<? extends DataObject>, ? extends DataObject> readAll() {
+ LOG.debug("Reading from all delegates: {}", this);
LOG.trace("Reading from all delegates: {}", rootReaders.values());
- final List<DataObject> objects = new ArrayList<>(rootReaders.size());
+ final Multimap<InstanceIdentifier<? extends DataObject>, DataObject> objects = LinkedListMultimap.create();
for (VppReader<? extends DataObject> rootReader : rootReaders.values()) {
LOG.debug("Reading from delegate: {}", rootReader);
final List<? extends DataObject> read = rootReader.read(rootReader.getManagedDataObjectType());
- objects.addAll(read);
+ objects.putAll(rootReader.getManagedDataObjectType(), read);
}
return objects;
}