summaryrefslogtreecommitdiffstats
path: root/v3po/data-impl/src/main/java
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-04-11 08:56:06 +0200
committerMarek Gradzki <mgradzki@cisco.com>2016-04-12 11:04:11 +0200
commitf93415dd8b3719b380b4295ab364420b9bf3d927 (patch)
tree057de7e397985b74cef738936983c7db6e741cd7 /v3po/data-impl/src/main/java
parentd99066504f76a181c90832b939956f43b409c075 (diff)
HONEYCOMB-34: Config tree initialization using ModifiableDataTree dependency
Change-Id: I9fa6119a92cc1979ed6f3364bb74e856a7a712c5 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/data-impl/src/main/java')
-rw-r--r--v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/ConfigDataTree.java10
-rw-r--r--v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/DataBroker.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.java15
-rw-r--r--v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/OperationalDataTreeModule.java8
4 files changed, 40 insertions, 1 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 59a555fda..b90a57acd 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
@@ -90,6 +90,8 @@ public final class ConfigDataTree implements ModifiableDataTree {
@Override
public void modify(final DataTreeModification modification)
throws DataValidationFailedException, TranslationException {
+ LOG.debug("ConfigDataTree.modify");
+
dataTree.validate(modification);
final DataTreeCandidate candidate = dataTree.prepare(modification);
@@ -135,6 +137,14 @@ 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/io/fd/honeycomb/v3po/data/impl/DataBroker.java b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/DataBroker.java
index 47b27f707..a0b585143 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
@@ -35,6 +35,8 @@ import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Data Broker which provides data transaction functionality for YANG capable data provider using {@link NormalizedNode}
@@ -42,6 +44,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
*/
public class DataBroker implements DOMDataBroker {
+ private static final Logger LOG = LoggerFactory.getLogger(DataBroker.class);
private final ReadableDataTree operationalDataTree;
private final ModifiableDataTree configDataTree;
@@ -56,16 +59,18 @@ public class DataBroker implements DOMDataBroker {
this.operationalDataTree =
Preconditions.checkNotNull(operationalDataTree, "operationalDataTree should not be null");
this.configDataTree = Preconditions.checkNotNull(configDataTree, "configDataTree should not be null");
+ LOG.trace("DataBroker({}).init() operationalDataTree={}, configDataTree={}", this, operationalDataTree, configDataTree);
}
@Override
public DOMDataReadOnlyTransaction newReadOnlyTransaction() {
+ LOG.trace("DataBroker({}).newReadOnlyTransaction()", this);
return new ReadOnlyTransaction(operationalDataTree, configDataTree.takeSnapshot());
}
@Override
public DOMDataReadWriteTransaction newReadWriteTransaction() {
- // todo use the same snapshot
+ LOG.trace("DataBroker({}).newReadWriteTransaction()", this);
final DataTreeSnapshot configSnapshot = configDataTree.takeSnapshot();
final DOMDataReadOnlyTransaction readOnlyTx = new ReadOnlyTransaction(operationalDataTree, configSnapshot);
final DOMDataWriteTransaction writeOnlyTx = new WriteTransaction(configDataTree, configSnapshot);
@@ -74,6 +79,7 @@ public class DataBroker implements DOMDataBroker {
@Override
public DOMDataWriteTransaction newWriteOnlyTransaction() {
+ LOG.trace("DataBroker({}).newWriteOnlyTransaction()", this);
return new WriteTransaction(configDataTree);
}
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 115eb065f..19267b1bd 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
@@ -9,9 +9,14 @@ 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;
public class ConfigDataTreeModule extends
org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411.AbstractConfigDataTreeModule {
+
+ private static final Logger LOG = LoggerFactory.getLogger(ConfigDataTreeModule.class);
+
public ConfigDataTreeModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(identifier, dependencyResolver);
@@ -31,6 +36,7 @@ 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());
return new CloseableConfigDataTree(
@@ -47,17 +53,26 @@ public class ConfigDataTreeModule extends
@Override
public void close() throws Exception {
+ LOG.info("CloseableConfigDataTree.close()");
// NOP
}
@Override
public void modify(final DataTreeModification modification)
throws DataValidationFailedException, TranslationException {
+ LOG.trace("CloseableConfigDataTree.modify modification={}", modification);
delegate.modify(modification);
}
@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/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 48053c366..0034b12c5 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
@@ -8,9 +8,14 @@ import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class OperationalDataTreeModule extends
org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411.AbstractOperationalDataTreeModule {
+
+ private static final Logger LOG = LoggerFactory.getLogger(OperationalDataTreeModule.class);
+
public OperationalDataTreeModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(identifier, dependencyResolver);
@@ -30,6 +35,7 @@ public class OperationalDataTreeModule extends
@Override
public java.lang.AutoCloseable createInstance() {
+ LOG.info("OperationalDataTreeModule.createInstance()");
return new CloseableOperationalDataTree(
new OperationalDataTree(getSerializerDependency(), getSchemaServiceDependency().getGlobalContext(),
getReaderRegistryDependency()));
@@ -45,12 +51,14 @@ public class OperationalDataTreeModule extends
@Override
public void close() throws Exception {
+ LOG.info("CloseableOperationalDataTree.close()");
// NOP
}
@Override
public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(
@Nonnull final YangInstanceIdentifier path) {
+ LOG.trace("CloseableOperationalDataTree.read path={}", path);
return delegate.read(path);
}
}