Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "BUG-1041 cli proposal #1"
[controller.git]
/
opendaylight
/
md-sal
/
sal-common-impl
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
md
/
sal
/
common
/
impl
/
util
/
compat
/
DataNormalizer.java
diff --git
a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizer.java
b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizer.java
index ec8ce6ecd5a96e628d2883ab38f24aaab383095a..113d3dc9f762ec1f0f2f6d4c7307ae3f04e0d19b 100644
(file)
--- a/
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizer.java
+++ b/
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizer.java
@@
-14,10
+14,12
@@
import com.google.common.base.Predicates;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
+
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
+
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
@@
-48,7
+50,7
@@
public class DataNormalizer {
ImmutableList.Builder<PathArgument> normalizedArgs = ImmutableList.builder();
DataNormalizationOperation<?> currentOp = operation;
ImmutableList.Builder<PathArgument> normalizedArgs = ImmutableList.builder();
DataNormalizationOperation<?> currentOp = operation;
- Iterator<PathArgument> arguments = legacy.getPath().iterator();
+ Iterator<PathArgument> arguments = legacy.getPath
Arguments
().iterator();
try {
while (arguments.hasNext()) {
try {
while (arguments.hasNext()) {
@@
-67,7
+69,7
@@
public class DataNormalizer {
throw new IllegalArgumentException(String.format("Failed to normalize path %s", legacy), e);
}
throw new IllegalArgumentException(String.format("Failed to normalize path %s", legacy), e);
}
- return
new InstanceIdentifier
(normalizedArgs.build());
+ return
InstanceIdentifier.create
(normalizedArgs.build());
}
public Map.Entry<InstanceIdentifier, NormalizedNode<?, ?>> toNormalized(
}
public Map.Entry<InstanceIdentifier, NormalizedNode<?, ?>> toNormalized(
@@
-81,7
+83,7
@@
public class DataNormalizer {
InstanceIdentifier normalizedPath = toNormalized(legacyPath);
DataNormalizationOperation<?> currentOp = operation;
InstanceIdentifier normalizedPath = toNormalized(legacyPath);
DataNormalizationOperation<?> currentOp = operation;
- for (PathArgument arg : normalizedPath.getPath()) {
+ for (PathArgument arg : normalizedPath.getPath
Arguments
()) {
try {
currentOp = currentOp.getChild(arg);
} catch (DataNormalizationException e) {
try {
currentOp = currentOp.getChild(arg);
} catch (DataNormalizationException e) {
@@
-103,9
+105,7
@@
public class DataNormalizer {
if (potentialOp.getIdentifier() instanceof AugmentationIdentifier) {
currentOp = potentialOp;
if (potentialOp.getIdentifier() instanceof AugmentationIdentifier) {
currentOp = potentialOp;
- ArrayList<PathArgument> reworkedArgs = new ArrayList<>(normalizedPath.getPath());
- reworkedArgs.add(potentialOp.getIdentifier());
- normalizedPath = new InstanceIdentifier(reworkedArgs);
+ normalizedPath = normalizedPath.node(potentialOp.getIdentifier());
}
}
}
}
@@
-117,15
+117,14
@@
public class DataNormalizer {
public InstanceIdentifier toLegacy(final InstanceIdentifier normalized) throws DataNormalizationException {
ImmutableList.Builder<PathArgument> legacyArgs = ImmutableList.builder();
public InstanceIdentifier toLegacy(final InstanceIdentifier normalized) throws DataNormalizationException {
ImmutableList.Builder<PathArgument> legacyArgs = ImmutableList.builder();
- PathArgument previous = null;
DataNormalizationOperation<?> currentOp = operation;
DataNormalizationOperation<?> currentOp = operation;
- for (PathArgument normalizedArg : normalized.getPath()) {
+ for (PathArgument normalizedArg : normalized.getPath
Arguments
()) {
currentOp = currentOp.getChild(normalizedArg);
if(!currentOp.isMixin()) {
legacyArgs.add(normalizedArg);
}
}
currentOp = currentOp.getChild(normalizedArg);
if(!currentOp.isMixin()) {
legacyArgs.add(normalizedArg);
}
}
- return
new InstanceIdentifier
(legacyArgs.build());
+ return
InstanceIdentifier.create
(legacyArgs.build());
}
public CompositeNode toLegacy(final InstanceIdentifier normalizedPath, final NormalizedNode<?, ?> normalizedData) {
}
public CompositeNode toLegacy(final InstanceIdentifier normalizedPath, final NormalizedNode<?, ?> normalizedData) {