summaryrefslogtreecommitdiffstats
path: root/v3po/data-impl/src
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-04-11 21:23:57 +0200
committerMarek Gradzki <mgradzki@cisco.com>2016-04-12 11:05:25 +0200
commit3edb738db9c756d42ee5c0b6fa172b6f2caa808a (patch)
tree3307a73d795046623f51bf7819a38d60a3347d75 /v3po/data-impl/src
parent69b1d68a74561f786805809ad44052ba6cfe8eb7 (diff)
HONEYCOMB-34: Config tree initialization using binding data broker
Change-Id: I070aca2cc35dd10ea5bde19c8cbf4cad1c50f468 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/data-impl/src')
-rw-r--r--v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/ConfigDataTree.java8
-rw-r--r--v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/ConfigDataTreeModule.java17
-rw-r--r--v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/InMemoryConfigDataTreeModule.java81
-rw-r--r--v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/InMemoryConfigDataTreeModuleFactory.java13
-rw-r--r--v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/OperationalDataTreeModule.java4
-rw-r--r--v3po/data-impl/src/main/yang/data-impl.yang31
6 files changed, 127 insertions, 27 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 b90a57acd..ab4cf6446 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
@@ -137,14 +137,6 @@ public final class ConfigDataTree implements ModifiableDataTree {
dataTree.commit(candidate);
}
- @Override
- public void initialize(final DataTreeModification modification) throws DataValidationFailedException {
- LOG.debug("ConfigDataTree.initialize");
- dataTree.validate(modification);
- final DataTreeCandidate candidate = dataTree.prepare(modification);
- dataTree.commit(candidate);
- }
-
private Map<InstanceIdentifier<?>, DataObject> extractNetconfData(
final Optional<NormalizedNode<?, ?>> parentOptional) {
if (parentOptional.isPresent()) {
diff --git a/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/ConfigDataTreeModule.java b/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/ConfigDataTreeModule.java
index 19267b1bd..86a3f9db4 100644
--- a/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/ConfigDataTreeModule.java
+++ b/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/ConfigDataTreeModule.java
@@ -4,11 +4,8 @@ import io.fd.honeycomb.v3po.data.DataTreeSnapshot;
import io.fd.honeycomb.v3po.data.ModifiableDataTree;
import io.fd.honeycomb.v3po.data.impl.ConfigDataTree;
import io.fd.honeycomb.v3po.translate.TranslationException;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,11 +33,9 @@ public class ConfigDataTreeModule extends
@Override
public java.lang.AutoCloseable createInstance() {
- LOG.info("ConfigDataTreeModule.createInstance()");
- final DataTree dataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION);
- dataTree.setSchemaContext(getSchemaServiceDependency().getGlobalContext());
+ LOG.debug("ConfigDataTreeModule.createInstance()");
return new CloseableConfigDataTree(
- new ConfigDataTree(getSerializerDependency(), dataTree, getWriterRegistryDependency()));
+ new ConfigDataTree(getSerializerDependency(), getDataTreeDependency(), getWriterRegistryDependency()));
}
private static final class CloseableConfigDataTree implements ModifiableDataTree, AutoCloseable {
@@ -53,7 +48,7 @@ public class ConfigDataTreeModule extends
@Override
public void close() throws Exception {
- LOG.info("CloseableConfigDataTree.close()");
+ LOG.debug("CloseableConfigDataTree.close()");
// NOP
}
@@ -65,12 +60,6 @@ public class ConfigDataTreeModule extends
}
@Override
- public void initialize(final DataTreeModification modification) throws DataValidationFailedException {
- LOG.trace("CloseableConfigDataTree.initialize modification={}", modification);
- delegate.initialize(modification);
- }
-
- @Override
public DataTreeSnapshot takeSnapshot() {
LOG.trace("CloseableConfigDataTree.takeSnapshot");
return delegate.takeSnapshot();
diff --git a/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/InMemoryConfigDataTreeModule.java b/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/InMemoryConfigDataTreeModule.java
new file mode 100644
index 000000000..9ae8a01f5
--- /dev/null
+++ b/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/InMemoryConfigDataTreeModule.java
@@ -0,0 +1,81 @@
+package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411;
+
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
+import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class InMemoryConfigDataTreeModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411.AbstractInMemoryConfigDataTreeModule {
+
+ private static final Logger LOG = LoggerFactory.getLogger(InMemoryConfigDataTreeModule.class);
+
+ public InMemoryConfigDataTreeModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public InMemoryConfigDataTreeModule(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.data.impl.rev160411.InMemoryConfigDataTreeModule 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() {
+ LOG.debug("InMemoryConfigDataTreeModule.createInstance()");
+ return new CloseableConfigDataTree(getSchemaServiceDependency().getGlobalContext());
+ }
+
+ private static class CloseableConfigDataTree implements AutoCloseable, DataTree {
+ private final DataTree dataTree;
+
+ public CloseableConfigDataTree(final SchemaContext schemaContext) {
+ this.dataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION);
+ dataTree.setSchemaContext(schemaContext);
+ }
+
+ @Override
+ public void close() throws Exception {
+ // NOP
+ }
+
+ @Override
+ public DataTreeSnapshot takeSnapshot() {
+ return dataTree.takeSnapshot();
+ }
+
+ @Override
+ public void setSchemaContext(final SchemaContext newSchemaContext) {
+ dataTree.setSchemaContext(newSchemaContext);
+ }
+
+ @Override
+ public void commit(final DataTreeCandidate candidate) {
+ dataTree.commit(candidate);
+ }
+
+ @Override
+ public YangInstanceIdentifier getRootPath() {
+ return dataTree.getRootPath();
+ }
+
+ @Override
+ public void validate(final DataTreeModification modification) throws DataValidationFailedException {
+ dataTree.validate(modification);
+ }
+
+ @Override
+ public DataTreeCandidate prepare(final DataTreeModification modification) {
+ return dataTree.prepare(modification);
+ }
+ }
+}
diff --git a/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/InMemoryConfigDataTreeModuleFactory.java b/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/InMemoryConfigDataTreeModuleFactory.java
new file mode 100644
index 000000000..504e007c0
--- /dev/null
+++ b/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/InMemoryConfigDataTreeModuleFactory.java
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: data-impl yang module local name: inmemory-config-data-tree
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Tue Apr 12 07:26:54 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.data.impl.rev160411;
+public class InMemoryConfigDataTreeModuleFactory extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411.AbstractInMemoryConfigDataTreeModuleFactory {
+
+}
diff --git a/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/OperationalDataTreeModule.java b/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/OperationalDataTreeModule.java
index 0034b12c5..24a1ca519 100644
--- a/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/OperationalDataTreeModule.java
+++ b/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/OperationalDataTreeModule.java
@@ -35,7 +35,7 @@ public class OperationalDataTreeModule extends
@Override
public java.lang.AutoCloseable createInstance() {
- LOG.info("OperationalDataTreeModule.createInstance()");
+ LOG.debug("OperationalDataTreeModule.createInstance()");
return new CloseableOperationalDataTree(
new OperationalDataTree(getSerializerDependency(), getSchemaServiceDependency().getGlobalContext(),
getReaderRegistryDependency()));
@@ -51,7 +51,7 @@ public class OperationalDataTreeModule extends
@Override
public void close() throws Exception {
- LOG.info("CloseableOperationalDataTree.close()");
+ LOG.debug("CloseableOperationalDataTree.close()");
// NOP
}
diff --git a/v3po/data-impl/src/main/yang/data-impl.yang b/v3po/data-impl/src/main/yang/data-impl.yang
index a1dfee301..43201a084 100644
--- a/v3po/data-impl/src/main/yang/data-impl.yang
+++ b/v3po/data-impl/src/main/yang/data-impl.yang
@@ -18,6 +18,32 @@ module data-impl {
"Initial revision.";
}
+ identity data-tree {
+ base "config:service-type";
+ config:java-class org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
+ }
+
+ identity inmemory-config-data-tree {
+ base config:module-type;
+ config:provided-service data-tree;
+ config:java-name-prefix InMemoryConfigDataTree;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case inmemory-config-data-tree {
+ when "/config:modules/config:module/config:type = 'inmemory-config-data-tree'";
+
+ container schema-service {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity dom:schema-service;
+ }
+ }
+ }
+ }
+ }
+
identity honeycomb-config-data-tree {
base config:module-type;
config:provided-service dapi:honeycomb-modifiable-data-tree;
@@ -28,11 +54,11 @@ module data-impl {
case honeycomb-config-data-tree {
when "/config:modules/config:module/config:type = 'honeycomb-config-data-tree'";
- container schema-service {
+ container data-tree {
uses config:service-ref {
refine type {
mandatory true;
- config:required-identity dom:schema-service;
+ config:required-identity data-tree;
}
}
}
@@ -97,5 +123,4 @@ module data-impl {
}
}
-
} \ No newline at end of file