From 799ee62f15dff07534beaf98a3ac551deffade38 Mon Sep 17 00:00:00 2001 From: Maros Marsalek Date: Tue, 17 May 2016 09:10:39 +0200 Subject: 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 --- .../fd/honeycomb/v3po/translate/impl/read/CompositeChildReader.java | 4 ++-- .../fd/honeycomb/v3po/translate/impl/read/CompositeListReader.java | 4 ++-- .../fd/honeycomb/v3po/translate/impl/read/CompositeRootReader.java | 2 +- .../v3po/translate/impl/write/AbstractCompositeWriter.java | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'v3po/translate-impl/src/main') 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 managedDataObjectType, @Nonnull final ChildReaderCustomizer customizer) { - this(managedDataObjectType, RWUtils.emptyChildReaderList(), RWUtils.emptyAugReaderList(), + this(managedDataObjectType, RWUtils.emptyChildReaderList(), RWUtils.emptyAugReaderList(), customizer); } @@ -112,7 +112,7 @@ public final class CompositeChildReader 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, K public List readList(@Nonnull final InstanceIdentifier id, @Nonnull final ReadContext ctx) throws ReadFailedException { LOG.trace("{}: Reading all list entries", this); - final List allIds = customizer.getAllIds(id, ctx.getContext()); + final List allIds = customizer.getAllIds(id, ctx); LOG.debug("{}: Reading list entries for: {}", this, allIds); final ArrayList allEntries = new ArrayList<>(allIds.size()); @@ -146,7 +146,7 @@ public final class CompositeListReader, K protected void readCurrentAttributes(@Nonnull final InstanceIdentifier 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 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 implements W // If there's no dedicated writer, use write current // But we need current data after to do so final InstanceIdentifier currentId = RWUtils.cutId(id, getManagedDataObjectType()); - Optional currentDataAfter = ctx.readAfter(currentId); + Optional 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 implements W private void updateSubtreeFromCurrent(final InstanceIdentifier id, final WriteContext ctx) throws WriteFailedException { final InstanceIdentifier currentId = RWUtils.cutId(id, getManagedDataObjectType()); - Optional currentDataBefore = ctx.readBefore(currentId); - Optional currentDataAfter = ctx.readAfter(currentId); + Optional currentDataBefore = ctx.readBefore(currentId); + Optional currentDataAfter = ctx.readAfter(currentId); LOG.debug("{}: Dedicated subtree writer missing for: {}. Updating current without subtree", this, RWUtils.getNextId(id, getManagedDataObjectType()).getType(), currentDataAfter); updateCurrent((InstanceIdentifier) id, castToManaged(currentDataBefore.orNull()), -- cgit 1.2.3-korg