summaryrefslogtreecommitdiffstats
path: root/infra/data-impl/src/main/java/io/fd
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2018-01-04 07:08:34 +0100
committerMarek Gradzki <mgradzki@cisco.com>2018-03-23 06:54:25 +0100
commit8acc5613345d9c50d0f33c3d74ae64e474b80724 (patch)
tree130723e4f6e4daa2fcc57538d971dfd34886c8a8 /infra/data-impl/src/main/java/io/fd
parentbc559d4e6ccbdbaf65e612e56b2fe5d0614ff623 (diff)
HONEYCOMB-424: bump ODL dependencies to Oxygen
Change-Id: I3160e5df4e66b3b3c732619fc1fc7599459fda76 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'infra/data-impl/src/main/java/io/fd')
-rw-r--r--infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java3
-rw-r--r--infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/Modification.java26
-rw-r--r--infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java4
-rw-r--r--infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/NormalizedNodeRewriteDeleteRegistry.java4
-rw-r--r--infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapter.java5
5 files changed, 23 insertions, 19 deletions
diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java
index 48b9e7913..8dcca2762 100644
--- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java
+++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java
@@ -75,7 +75,8 @@ public class ModifiableDataTreeManager implements ModifiableDataManager {
@Override
public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(
@Nonnull final YangInstanceIdentifier path) {
- final Optional<NormalizedNode<?, ?>> node = modification.readNode(path);
+ // FIXME switch to java.util.Optional when rest of ODL infra does
+ final Optional<NormalizedNode<?, ?>> node = Optional.fromNullable(modification.readNode(path).orElse(null));
if (LOG.isTraceEnabled() && node.isPresent()) {
LOG.trace("ConfigSnapshot.read: {}", node.get());
}
diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/Modification.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/Modification.java
index 88823c53d..45a207cec 100644
--- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/Modification.java
+++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/Modification.java
@@ -29,7 +29,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.MixinNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode;
import org.opendaylight.yangtools.yang.model.api.AugmentationTarget;
import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
@@ -89,11 +89,13 @@ final class Modification {
}
com.google.common.base.Optional<NormalizedNode<?, ?>> getDataBefore() {
- return dataCandidate.getDataBefore();
+ // FIXME switch to java.util.Optional when rest of ODL infra does
+ return com.google.common.base.Optional.fromNullable(dataCandidate.getDataBefore().orElse(null));
}
com.google.common.base.Optional<NormalizedNode<?, ?>> getDataAfter() {
- return dataCandidate.getDataAfter();
+ // FIXME switch to java.util.Optional when rest of ODL infra does
+ return com.google.common.base.Optional.fromNullable(dataCandidate.getDataAfter().orElse(null));
}
Object getSchemaNode() {
@@ -107,25 +109,25 @@ final class Modification {
boolean isMixin() {
// Checking whether node is a mixin is not performed on schema, but on data since mixin is
// only a NormalizedNode concept, not a schema concept
- return dataCandidate.getDataBefore().orNull() instanceof MixinNode ||
- dataCandidate.getDataAfter().orNull() instanceof MixinNode;
+ return dataCandidate.getDataBefore().orElse(null) instanceof MixinNode ||
+ dataCandidate.getDataAfter().orElse(null) instanceof MixinNode;
}
boolean isBeforeAndAfterDifferent() {
if (dataCandidate.getDataBefore().isPresent()) {
- return !dataCandidate.getDataBefore().get().equals(dataCandidate.getDataAfter().orNull());
+ return !dataCandidate.getDataBefore().get().equals(dataCandidate.getDataAfter().orElse(null));
}
// considering not a modification if data after is also null
return dataCandidate.getDataAfter().isPresent();
}
- private AugmentationSchema findAugmentation(Object currentNode,
- final YangInstanceIdentifier.AugmentationIdentifier identifier) {
+ private AugmentationSchemaNode findAugmentation(Object currentNode,
+ final YangInstanceIdentifier.AugmentationIdentifier identifier) {
if (currentNode != null) {
// check if identifier points to some augmentation of currentNode
if (currentNode instanceof AugmentationTarget) {
- Optional<AugmentationSchema> augmentationSchema =
+ Optional<AugmentationSchemaNode> augmentationSchema =
((AugmentationTarget) currentNode).getAvailableAugmentations().stream()
.filter(aug -> identifier.equals(new YangInstanceIdentifier.AugmentationIdentifier(
aug.getChildNodes().stream()
@@ -142,7 +144,7 @@ final class Modification {
if (currentNode instanceof DataNodeContainer) {
childNodes = ((DataNodeContainer) currentNode).getChildNodes();
} else if (currentNode instanceof ChoiceSchemaNode) {
- childNodes = ((ChoiceSchemaNode) currentNode).getCases().stream()
+ childNodes = ((ChoiceSchemaNode) currentNode).getCases().values().stream()
.flatMap(cas -> cas.getChildNodes().stream()).collect(Collectors.toList());
}
return childNodes.stream().map(n -> findAugmentation(n, identifier)).filter(n -> n != null).findFirst()
@@ -161,7 +163,7 @@ final class Modification {
// An augment cannot change other augment, so we do not update parent node if we are streaming
// children of AugmentationSchema (otherwise we would fail to find schema for nested augmentations):
if (updateParentNode) {
- if (schemaNode instanceof AugmentationSchema) {
+ if (schemaNode instanceof AugmentationSchemaNode) {
// child nodes would not have nested augmentations, so we stop moving parentNode:
return new Modification(childId, child, parentNode, schemaChild, false);
} else {
@@ -218,7 +220,7 @@ final class Modification {
}
} else if (schemaNode instanceof ChoiceSchemaNode) {
// For choices, iterate through all the cases
- final Optional<DataSchemaNode> maybeChild = ((ChoiceSchemaNode) schemaNode).getCases().stream()
+ final Optional<DataSchemaNode> maybeChild = ((ChoiceSchemaNode) schemaNode).getCases().values().stream()
.flatMap(cas -> cas.getChildNodes().stream())
.filter(child -> child.getQName().equals(identifier.getNodeType()))
.findFirst();
diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java
index 9d97d9141..98950b243 100644
--- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java
+++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java
@@ -33,7 +33,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.MixinNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.impl.schema.nodes.AbstractImmutableDataContainerNode;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
@@ -176,7 +176,7 @@ final class ModificationDiff {
// APPEAR/DISAPPEAR are not valid modifications, but some of the children can be modified
// aka. list entry added to nested list under non-presence container, which would be resolved as APPEAR for
// that container, but MERGE for nested list
- if (modification.isMixin() && !modification.is(AugmentationSchema.class)) {
+ if (modification.isMixin() && !modification.is(AugmentationSchemaNode.class)) {
return false;
} else {
return isCurrentModified(modification);
diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/NormalizedNodeRewriteDeleteRegistry.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/NormalizedNodeRewriteDeleteRegistry.java
index c7832ac0e..9cd14063d 100644
--- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/NormalizedNodeRewriteDeleteRegistry.java
+++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/NormalizedNodeRewriteDeleteRegistry.java
@@ -28,7 +28,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
-import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
+import org.opendaylight.yangtools.yang.model.api.CaseSchemaNode;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -86,7 +86,7 @@ final class NormalizedNodeRewriteDeleteRegistry implements RewriteDeleteProducer
return choiceDeleteProducer.normalizedUpdates(topLevelIdentifier, entry);
}
- if (entry.getValue() instanceof ChoiceCaseNode) {
+ if (entry.getValue() instanceof CaseSchemaNode) {
LOG.debug("Processing case {}", topLevelIdentifier);
return caseDeleteProducer.normalizedUpdates(topLevelIdentifier, entry);
}
diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapter.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapter.java
index 3c356c256..d779e6258 100644
--- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapter.java
+++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapter.java
@@ -21,19 +21,20 @@ import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.MoreObjects;
-import com.google.common.base.Optional;
import io.fd.honeycomb.translate.util.JsonUtils;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
+import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.controller.sal.core.api.model.SchemaService;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
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.DataTreeCandidateTip;
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;
@@ -163,7 +164,7 @@ public class PersistingDataTreeAdapter implements DataTree {
}
@Override
- public DataTreeCandidate prepare(
+ public DataTreeCandidateTip prepare(
final DataTreeModification dataTreeModification) {
return delegateDependency.prepare(dataTreeModification);
}