diff options
Diffstat (limited to 'v3po/data-impl/src')
6 files changed, 79 insertions, 17 deletions
diff --git a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/ConfigDataTree.java b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/ConfigDataTree.java index 84a1d27e3..f636e6708 100644 --- a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/ConfigDataTree.java +++ b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/ConfigDataTree.java @@ -34,7 +34,7 @@ import java.util.Map; import javax.annotation.Nonnull; import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException; import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction; -import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; +import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; diff --git a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/DataBroker.java b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/DataBroker.java index 7b4d93baa..47b27f707 100644 --- a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/DataBroker.java +++ b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/DataBroker.java @@ -17,9 +17,9 @@ package io.fd.honeycomb.v3po.data.impl; import com.google.common.base.Preconditions; -import io.fd.honeycomb.v3po.data.ReadableDataTree; -import io.fd.honeycomb.v3po.data.ModifiableDataTree; import io.fd.honeycomb.v3po.data.DataTreeSnapshot; +import io.fd.honeycomb.v3po.data.ModifiableDataTree; +import io.fd.honeycomb.v3po.data.ReadableDataTree; import java.util.Collections; import java.util.Map; import javax.annotation.Nonnull; @@ -37,36 +37,37 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; /** - * Data Broker which provides data transaction functionality for YANG capable data provider - * using {@link NormalizedNode} data format. + * Data Broker which provides data transaction functionality for YANG capable data provider using {@link NormalizedNode} + * data format. */ public class DataBroker implements DOMDataBroker { - private final ReadableDataTree operationalData; + private final ReadableDataTree operationalDataTree; private final ModifiableDataTree configDataTree; /** * Creates DataBroker instance. * - * @param operationalData operational data - * @param configDataTree configuration data + * @param operationalDataTree operational data + * @param configDataTree configuration data */ - public DataBroker(@Nonnull final ReadableDataTree operationalData, + public DataBroker(@Nonnull final ReadableDataTree operationalDataTree, @Nonnull final ModifiableDataTree configDataTree) { - this.operationalData = Preconditions.checkNotNull(operationalData, "operationalData should not be null"); - this.configDataTree = Preconditions.checkNotNull(configDataTree, "configDataProxy should not be null"); + this.operationalDataTree = + Preconditions.checkNotNull(operationalDataTree, "operationalDataTree should not be null"); + this.configDataTree = Preconditions.checkNotNull(configDataTree, "configDataTree should not be null"); } @Override public DOMDataReadOnlyTransaction newReadOnlyTransaction() { - return new ReadOnlyTransaction(operationalData, configDataTree.takeSnapshot()); + return new ReadOnlyTransaction(operationalDataTree, configDataTree.takeSnapshot()); } @Override public DOMDataReadWriteTransaction newReadWriteTransaction() { // todo use the same snapshot final DataTreeSnapshot configSnapshot = configDataTree.takeSnapshot(); - final DOMDataReadOnlyTransaction readOnlyTx = new ReadOnlyTransaction(operationalData, configSnapshot); + final DOMDataReadOnlyTransaction readOnlyTx = new ReadOnlyTransaction(operationalDataTree, configSnapshot); final DOMDataWriteTransaction writeOnlyTx = new WriteTransaction(configDataTree, configSnapshot); return new ReadWriteTransaction(readOnlyTx, writeOnlyTx); } diff --git a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/DataTreeUtils.java b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/DataTreeUtils.java index 39e841f9a..de83a198b 100644 --- a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/DataTreeUtils.java +++ b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/DataTreeUtils.java @@ -21,7 +21,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.Map; import javax.annotation.Nonnull; -import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; +import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; diff --git a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTree.java b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTree.java index 21672b48b..de737c729 100644 --- a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTree.java +++ b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTree.java @@ -35,7 +35,7 @@ import java.util.Collection; import java.util.Map; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; +import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; @@ -75,7 +75,7 @@ public final class OperationalDataTree implements ReadableDataTree { */ public OperationalDataTree(@Nonnull BindingNormalizedNodeSerializer serializer, @Nonnull final SchemaContext globalContext, @Nonnull ReaderRegistry readerRegistry) { - this.globalContext = checkNotNull(globalContext, "serializer should not be null"); + this.globalContext = checkNotNull(globalContext, "globalContext should not be null"); this.serializer = checkNotNull(serializer, "serializer should not be null"); this.readerRegistry = checkNotNull(readerRegistry, "reader should not be null"); } diff --git a/v3po/data-impl/src/main/yang/data-impl.yang b/v3po/data-impl/src/main/yang/data-impl.yang new file mode 100644 index 000000000..093e1725b --- /dev/null +++ b/v3po/data-impl/src/main/yang/data-impl.yang @@ -0,0 +1,61 @@ +module translate-utils { + yang-version 1; + namespace "urn:honeycomb:params:xml:ns:yang:translate:utils"; + prefix "tutils"; + + import config { prefix config; revision-date 2013-04-05; } + import translate-api { prefix tapi; revision-date 2016-04-06; } + + description + "This module contains translation layer utilities"; + + revision "2016-04-06" { + description + "Initial revision."; + } + + identity delegating-reader-registry { + base config:module-type; + config:provided-service tapi:honeycomb-reader-registry; + config:java-name-prefix DelegatingReaderRegistry; + } + + augment "/config:modules/config:module/config:configuration" { + case delegating-reader-registry { + when "/config:modules/config:module/config:type = 'delegating-reader-registry'"; + + list root-readers { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity tapi:honeycomb-reader; + } + } + } + + } + } + + identity delegating-writer-registry { + base config:module-type; + config:provided-service tapi:honeycomb-writer-registry; + config:java-name-prefix DelegatingWriterRegistry; + } + + augment "/config:modules/config:module/config:configuration" { + case delegating-writer-registry { + when "/config:modules/config:module/config:type = 'delegating-writer-registry'"; + + list root-writers { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity tapi:honeycomb-writer; + } + } + } + + } + } + +}
\ No newline at end of file diff --git a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTreeTest.java b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTreeTest.java index f4c2f1e5b..fbd512915 100644 --- a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTreeTest.java +++ b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTreeTest.java @@ -41,7 +41,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException; -import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; +import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppState; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; |