diff options
author | Maros Marsalek <mmarsale@cisco.com> | 2016-05-17 09:10:39 +0200 |
---|---|---|
committer | Maros Marsalek <mmarsale@cisco.com> | 2016-05-23 09:24:12 +0000 |
commit | d54ea758da8dcf71d52727c4f01f87090c50bf2e (patch) | |
tree | bf86e49ad4899b50c97654ae144d4b2e8902d1b8 /v3po/translate-impl | |
parent | 9e59a344c5a5b81fb7b7292184e849ad0fc9507c (diff) |
HONEYCOMB-61: Add BA broker for context data tree
With broker, context data can be accessed in a transactional
manner, same as config data
+ Renamed data-api concepts to not include DataTree
+ Renamed context related concepts to better distinguish between them
+ Now passing full ReadContext to read customizers
+ Naming context is backed by context data broker
Change-Id: I0b2876dd74a31a9ced7d9b5145672868e12f8b82
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'v3po/translate-impl')
4 files changed, 8 insertions, 8 deletions
diff --git a/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/read/CompositeChildReader.java b/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/read/CompositeChildReader.java index 1984cd86d..89f9f5675 100644 --- a/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/read/CompositeChildReader.java +++ b/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/read/CompositeChildReader.java @@ -93,7 +93,7 @@ public final class CompositeChildReader<C extends DataObject, B extends Builder< */ public CompositeChildReader(@Nonnull final Class<C> managedDataObjectType, @Nonnull final ChildReaderCustomizer<C, B> customizer) { - this(managedDataObjectType, RWUtils.<C>emptyChildReaderList(), RWUtils.<C>emptyAugReaderList(), + this(managedDataObjectType, RWUtils.emptyChildReaderList(), RWUtils.emptyAugReaderList(), customizer); } @@ -112,7 +112,7 @@ public final class CompositeChildReader<C extends DataObject, B extends Builder< protected void readCurrentAttributes(@Nonnull final InstanceIdentifier<C> id, @Nonnull final B builder, @Nonnull final ReadContext ctx) throws ReadFailedException { - customizer.readCurrentAttributes(id, builder, ctx.getContext()); + customizer.readCurrentAttributes(id, builder, ctx); } @Override diff --git a/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/read/CompositeListReader.java b/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/read/CompositeListReader.java index 4c84c3afe..7c438f669 100644 --- a/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/read/CompositeListReader.java +++ b/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/read/CompositeListReader.java @@ -124,7 +124,7 @@ public final class CompositeListReader<C extends DataObject & Identifiable<K>, K public List<C> readList(@Nonnull final InstanceIdentifier<C> id, @Nonnull final ReadContext ctx) throws ReadFailedException { LOG.trace("{}: Reading all list entries", this); - final List<K> allIds = customizer.getAllIds(id, ctx.getContext()); + final List<K> allIds = customizer.getAllIds(id, ctx); LOG.debug("{}: Reading list entries for: {}", this, allIds); final ArrayList<C> allEntries = new ArrayList<>(allIds.size()); @@ -146,7 +146,7 @@ public final class CompositeListReader<C extends DataObject & Identifiable<K>, K protected void readCurrentAttributes(@Nonnull final InstanceIdentifier<C> id, @Nonnull final B builder, @Nonnull final ReadContext ctx) throws ReadFailedException { - customizer.readCurrentAttributes(id, builder, ctx.getContext()); + customizer.readCurrentAttributes(id, builder, ctx); } @Override diff --git a/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/read/CompositeRootReader.java b/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/read/CompositeRootReader.java index 0abae70be..ea157aafd 100644 --- a/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/read/CompositeRootReader.java +++ b/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/read/CompositeRootReader.java @@ -99,7 +99,7 @@ public final class CompositeRootReader<C extends DataObject, B extends Builder<C @Override protected void readCurrentAttributes(@Nonnull final InstanceIdentifier<C> id, @Nonnull final B builder, @Nonnull final ReadContext ctx) throws ReadFailedException { - customizer.readCurrentAttributes(id, builder, ctx.getContext()); + customizer.readCurrentAttributes(id, builder, ctx); } @Override diff --git a/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/write/AbstractCompositeWriter.java b/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/write/AbstractCompositeWriter.java index 580910e8c..8b42a6c6f 100644 --- a/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/write/AbstractCompositeWriter.java +++ b/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/write/AbstractCompositeWriter.java @@ -232,7 +232,7 @@ public abstract class AbstractCompositeWriter<D extends DataObject> implements W // If there's no dedicated writer, use write current // But we need current data after to do so final InstanceIdentifier<D> currentId = RWUtils.cutId(id, getManagedDataObjectType()); - Optional<DataObject> currentDataAfter = ctx.readAfter(currentId); + Optional<D> currentDataAfter = ctx.readAfter(currentId); LOG.debug("{}: Dedicated subtree writer missing for: {}. Writing current.", this, RWUtils.getNextId(id, getManagedDataObjectType()).getType(), currentDataAfter); writeCurrent(currentId, castToManaged(currentDataAfter.get()), ctx); @@ -260,8 +260,8 @@ public abstract class AbstractCompositeWriter<D extends DataObject> implements W private void updateSubtreeFromCurrent(final InstanceIdentifier<? extends DataObject> id, final WriteContext ctx) throws WriteFailedException { final InstanceIdentifier<D> currentId = RWUtils.cutId(id, getManagedDataObjectType()); - Optional<DataObject> currentDataBefore = ctx.readBefore(currentId); - Optional<DataObject> currentDataAfter = ctx.readAfter(currentId); + Optional<D> currentDataBefore = ctx.readBefore(currentId); + Optional<D> currentDataAfter = ctx.readAfter(currentId); LOG.debug("{}: Dedicated subtree writer missing for: {}. Updating current without subtree", this, RWUtils.getNextId(id, getManagedDataObjectType()).getType(), currentDataAfter); updateCurrent((InstanceIdentifier<D>) id, castToManaged(currentDataBefore.orNull()), |