diff options
author | 2016-04-12 10:13:31 +0200 | |
---|---|---|
committer | 2016-04-12 10:13:31 +0200 | |
commit | 695eead109ef26d26277675210275a423a5dad50 (patch) | |
tree | 80c8567917026154a3b6f199bc0544267adf3bbe /v3po/translate-utils/src/main/java/org/opendaylight/yang/gen | |
parent | 5f82161cddaf35acbb6197139deaf604cdc4aca0 (diff) |
HONEYCOMB-9: Add configuration and wiring for readers and writers
Remove config module
Wrap vpp-japi in a config module
Change-Id: Iee1e0c653309bd3c1019323ce689dacf3ed995cd
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'v3po/translate-utils/src/main/java/org/opendaylight/yang/gen')
4 files changed, 188 insertions, 0 deletions
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 { + +} |