summaryrefslogtreecommitdiffstats
path: root/v3po/translate-utils
diff options
context:
space:
mode:
Diffstat (limited to 'v3po/translate-utils')
-rw-r--r--v3po/translate-utils/pom.xml4
-rw-r--r--v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingReaderRegistryModule.java80
-rw-r--r--v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingReaderRegistryModuleFactory.java13
-rw-r--r--v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingWriterRegistryModule.java82
-rw-r--r--v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingWriterRegistryModuleFactory.java13
-rw-r--r--v3po/translate-utils/src/main/yang/translate-utils.yang61
6 files changed, 251 insertions, 2 deletions
diff --git a/v3po/translate-utils/pom.xml b/v3po/translate-utils/pom.xml
index d547cb483..346757cc2 100644
--- a/v3po/translate-utils/pom.xml
+++ b/v3po/translate-utils/pom.xml
@@ -17,9 +17,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>io.fd.honeycomb.common</groupId>
- <artifactId>api-parent</artifactId>
+ <artifactId>impl-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
- <relativePath>../../common/api-parent</relativePath>
+ <relativePath>../../common/impl-parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingReaderRegistryModule.java b/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingReaderRegistryModule.java
new file mode 100644
index 000000000..0eb5062d5
--- /dev/null
+++ b/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingReaderRegistryModule.java
@@ -0,0 +1,80 @@
+package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.translate.utils.rev160406;
+
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Multimap;
+import io.fd.honeycomb.v3po.translate.read.ReadContext;
+import io.fd.honeycomb.v3po.translate.read.ReadFailedException;
+import io.fd.honeycomb.v3po.translate.read.Reader;
+import io.fd.honeycomb.v3po.translate.read.ReaderRegistry;
+import io.fd.honeycomb.v3po.translate.util.read.DelegatingReaderRegistry;
+import java.util.List;
+import javax.annotation.Nonnull;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class DelegatingReaderRegistryModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.translate.utils.rev160406.AbstractDelegatingReaderRegistryModule {
+ public DelegatingReaderRegistryModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public DelegatingReaderRegistryModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.translate.utils.rev160406.DelegatingReaderRegistryModule oldModule, java.lang.AutoCloseable oldInstance) {
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
+
+ @Override
+ public void customValidation() {
+ // add custom validation form module attributes here.
+ }
+
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+ final List<Reader<? extends DataObject>> rootReadersDependency = Lists.transform(getRootReadersDependency(),
+ new Function<Reader, Reader<? extends DataObject>>() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Reader<? extends DataObject> apply(final Reader input) {
+ return input;
+ }
+ });
+ return new CloseableReaderRegistry(new DelegatingReaderRegistry(rootReadersDependency));
+ }
+
+ // TODO move to translate-utils
+ private static final class CloseableReaderRegistry implements ReaderRegistry, AutoCloseable {
+ private final DelegatingReaderRegistry delegatingReaderRegistry;
+
+ CloseableReaderRegistry(
+ final DelegatingReaderRegistry delegatingReaderRegistry) {
+ this.delegatingReaderRegistry = delegatingReaderRegistry;
+ }
+
+ @Override
+ @Nonnull
+ public Multimap<InstanceIdentifier<? extends DataObject>, ? extends DataObject> readAll(
+ @Nonnull final ReadContext ctx) throws ReadFailedException {
+ return delegatingReaderRegistry.readAll(ctx);
+ }
+
+ @Nonnull
+ @Override
+ public Optional<? extends DataObject> read(
+ @Nonnull final InstanceIdentifier<? extends DataObject> id,
+ @Nonnull final ReadContext ctx) throws ReadFailedException {
+ return delegatingReaderRegistry.read(id, ctx);
+ }
+
+ @Nonnull
+ @Override
+ public InstanceIdentifier<DataObject> getManagedDataObjectType() {
+ return delegatingReaderRegistry.getManagedDataObjectType();
+ }
+
+ @Override
+ public void close() throws Exception {
+ // NOOP
+ }
+ }
+}
diff --git a/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingReaderRegistryModuleFactory.java b/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingReaderRegistryModuleFactory.java
new file mode 100644
index 000000000..214ab0f90
--- /dev/null
+++ b/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingReaderRegistryModuleFactory.java
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: translate-utils yang module local name: delegating-reader-registry
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Wed Apr 06 12:32:43 CEST 2016
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.translate.utils.rev160406;
+public class DelegatingReaderRegistryModuleFactory extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.translate.utils.rev160406.AbstractDelegatingReaderRegistryModuleFactory {
+
+}
diff --git a/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingWriterRegistryModule.java b/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingWriterRegistryModule.java
new file mode 100644
index 000000000..a629a294f
--- /dev/null
+++ b/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingWriterRegistryModule.java
@@ -0,0 +1,82 @@
+package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.translate.utils.rev160406;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Lists;
+import io.fd.honeycomb.v3po.translate.TranslationException;
+import io.fd.honeycomb.v3po.translate.util.write.DelegatingWriterRegistry;
+import io.fd.honeycomb.v3po.translate.write.WriteContext;
+import io.fd.honeycomb.v3po.translate.write.Writer;
+import io.fd.honeycomb.v3po.translate.write.WriterRegistry;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class DelegatingWriterRegistryModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.translate.utils.rev160406.AbstractDelegatingWriterRegistryModule {
+ public DelegatingWriterRegistryModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public DelegatingWriterRegistryModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.translate.utils.rev160406.DelegatingWriterRegistryModule oldModule, java.lang.AutoCloseable oldInstance) {
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
+
+ @Override
+ public void customValidation() {
+ // add custom validation form module attributes here.
+ }
+
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+ final List<Writer<? extends DataObject>> rootReadersDependency = Lists.transform(getRootWritersDependency(),
+ new Function<Writer, Writer<? extends DataObject>>() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Writer<? extends DataObject> apply(final Writer input) {
+ return input;
+ }
+ });
+ return new CloseableWriterRegistry(new DelegatingWriterRegistry(rootReadersDependency));
+ }
+
+ // TODO move to translate-utils
+ private static final class CloseableWriterRegistry implements WriterRegistry, AutoCloseable {
+ private final DelegatingWriterRegistry delegatingWriterRegistry;
+
+ CloseableWriterRegistry(
+ final DelegatingWriterRegistry delegatingWriterRegistry) {
+ this.delegatingWriterRegistry = delegatingWriterRegistry;
+ }
+
+ @Override
+ public void update(
+ @Nonnull final Map<InstanceIdentifier<?>, DataObject> nodesBefore,
+ @Nonnull final Map<InstanceIdentifier<?>, DataObject> nodesAfter,
+ @Nonnull final WriteContext ctx) throws TranslationException {
+ delegatingWriterRegistry.update(nodesBefore, nodesAfter, ctx);
+ }
+
+ @Override
+ public void update(
+ @Nonnull final InstanceIdentifier<? extends DataObject> id,
+ @Nullable final DataObject dataBefore, @Nullable final DataObject dataAfter,
+ @Nonnull final WriteContext ctx) throws TranslationException {
+ delegatingWriterRegistry.update(id, dataBefore, dataAfter, ctx);
+ }
+
+ @Nonnull
+ @Override
+ public InstanceIdentifier<DataObject> getManagedDataObjectType() {
+ return delegatingWriterRegistry.getManagedDataObjectType();
+ }
+
+ @Override
+ public void close() throws Exception {
+ // NOOP
+ }
+ }
+
+}
diff --git a/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingWriterRegistryModuleFactory.java b/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingWriterRegistryModuleFactory.java
new file mode 100644
index 000000000..ab3b820d3
--- /dev/null
+++ b/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingWriterRegistryModuleFactory.java
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: translate-utils yang module local name: delegating-writer-registry
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Wed Apr 06 16:32:08 CEST 2016
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.translate.utils.rev160406;
+public class DelegatingWriterRegistryModuleFactory extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.translate.utils.rev160406.AbstractDelegatingWriterRegistryModuleFactory {
+
+}
diff --git a/v3po/translate-utils/src/main/yang/translate-utils.yang b/v3po/translate-utils/src/main/yang/translate-utils.yang
new file mode 100644
index 000000000..093e1725b
--- /dev/null
+++ b/v3po/translate-utils/src/main/yang/translate-utils.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