Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Remove remoterpc dead code.
[controller.git]
/
opendaylight
/
md-sal
/
sal-dom-broker
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
md
/
sal
/
dom
/
store
/
impl
/
tree
/
data
/
NormalizedNodeContainerModificationStrategy.java
diff --git
a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/data/NormalizedNodeContainerModificationStrategy.java
b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/data/NormalizedNodeContainerModificationStrategy.java
index 3a3af5ecab966049196c576df7f6c7bd24b560a2..1d10ab6ea5a971dfc3e4a160949fd6f5c17fd30b 100644
(file)
--- a/
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/data/NormalizedNodeContainerModificationStrategy.java
+++ b/
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/data/NormalizedNodeContainerModificationStrategy.java
@@
-11,9
+11,8
@@
import static com.google.common.base.Preconditions.checkArgument;
import java.util.Map;
import java.util.Map;
-import org.opendaylight.controller.md.sal.dom.store.impl.tree.Data
Precondi
tionFailedException;
+import org.opendaylight.controller.md.sal.dom.store.impl.tree.Data
Valida
tionFailedException;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.ModificationType;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.ModificationType;
-import org.opendaylight.controller.md.sal.dom.store.impl.tree.StoreUtils;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.data.DataNodeContainerModificationStrategy.ListEntryModificationStrategy;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.data.ValueNodeModificationStrategy.LeafSetEntryModificationStrategy;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.spi.MutableTreeNode;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.data.DataNodeContainerModificationStrategy.ListEntryModificationStrategy;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.data.ValueNodeModificationStrategy.LeafSetEntryModificationStrategy;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.spi.MutableTreeNode;
@@
-68,7
+67,7
@@
abstract class NormalizedNodeContainerModificationStrategy extends SchemaAwareAp
@Override
protected void checkWriteApplicable(final InstanceIdentifier path, final NodeModification modification,
@Override
protected void checkWriteApplicable(final InstanceIdentifier path, final NodeModification modification,
- final Optional<TreeNode> current) throws Data
Precondi
tionFailedException {
+ final Optional<TreeNode> current) throws Data
Valida
tionFailedException {
// FIXME: Implement proper write check for replacement of node container
// prerequisite is to have transaction chain available for clients
// otherwise this will break chained writes to same node.
// FIXME: Implement proper write check for replacement of node container
// prerequisite is to have transaction chain available for clients
// otherwise this will break chained writes to same node.
@@
-95,16
+94,9
@@
abstract class NormalizedNodeContainerModificationStrategy extends SchemaAwareAp
@Override
protected TreeNode applyWrite(final ModifiedNode modification,
@Override
protected TreeNode applyWrite(final ModifiedNode modification,
- final Optional<TreeNode> currentMeta, final Version subtreeVersion) {
- final Version nodeVersion;
- if (currentMeta.isPresent()) {
- nodeVersion = currentMeta.get().getVersion().next();
- } else {
- nodeVersion = subtreeVersion;
- }
-
+ final Optional<TreeNode> currentMeta, final Version version) {
final NormalizedNode<?, ?> newValue = modification.getWrittenValue();
final NormalizedNode<?, ?> newValue = modification.getWrittenValue();
- final TreeNode newValueMeta = TreeNodeFactory.createTreeNode(newValue,
nodeV
ersion);
+ final TreeNode newValueMeta = TreeNodeFactory.createTreeNode(newValue,
v
ersion);
if (Iterables.isEmpty(modification.getChildren())) {
return newValueMeta;
if (Iterables.isEmpty(modification.getChildren())) {
return newValueMeta;
@@
-122,12
+114,12
@@
abstract class NormalizedNodeContainerModificationStrategy extends SchemaAwareAp
* and run the common parts on it -- which end with the node being sealed.
*/
final MutableTreeNode mutable = newValueMeta.mutable();
* and run the common parts on it -- which end with the node being sealed.
*/
final MutableTreeNode mutable = newValueMeta.mutable();
- mutable.setSubtreeVersion(
subtreeV
ersion);
+ mutable.setSubtreeVersion(
v
ersion);
@SuppressWarnings("rawtypes")
final NormalizedNodeContainerBuilder dataBuilder = createBuilder(newValue);
@SuppressWarnings("rawtypes")
final NormalizedNodeContainerBuilder dataBuilder = createBuilder(newValue);
- return mutateChildren(mutable, dataBuilder,
nodeV
ersion, modification.getChildren());
+ return mutateChildren(mutable, dataBuilder,
v
ersion, modification.getChildren());
}
@SuppressWarnings({ "rawtypes", "unchecked" })
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@@
-155,47
+147,44
@@
abstract class NormalizedNodeContainerModificationStrategy extends SchemaAwareAp
@Override
protected TreeNode applyMerge(final ModifiedNode modification, final TreeNode currentMeta,
@Override
protected TreeNode applyMerge(final ModifiedNode modification, final TreeNode currentMeta,
- final Version
subtreeV
ersion) {
+ final Version
v
ersion) {
// For Node Containers - merge is same as subtree change - we only replace children.
// For Node Containers - merge is same as subtree change - we only replace children.
- return applySubtreeChange(modification, currentMeta,
subtreeV
ersion);
+ return applySubtreeChange(modification, currentMeta,
v
ersion);
}
@Override
public TreeNode applySubtreeChange(final ModifiedNode modification,
}
@Override
public TreeNode applySubtreeChange(final ModifiedNode modification,
- final TreeNode currentMeta, final Version subtreeVersion) {
- // Bump subtree version to its new target
- final Version updatedSubtreeVersion = currentMeta.getSubtreeVersion().next();
-
+ final TreeNode currentMeta, final Version version) {
final MutableTreeNode newMeta = currentMeta.mutable();
final MutableTreeNode newMeta = currentMeta.mutable();
- newMeta.setSubtreeVersion(
updatedSubtreeV
ersion);
+ newMeta.setSubtreeVersion(
v
ersion);
@SuppressWarnings("rawtypes")
NormalizedNodeContainerBuilder dataBuilder = createBuilder(currentMeta.getData());
@SuppressWarnings("rawtypes")
NormalizedNodeContainerBuilder dataBuilder = createBuilder(currentMeta.getData());
- return mutateChildren(newMeta, dataBuilder,
updatedSubtreeV
ersion, modification.getChildren());
+ return mutateChildren(newMeta, dataBuilder,
v
ersion, modification.getChildren());
}
@Override
protected void checkSubtreeModificationApplicable(final InstanceIdentifier path, final NodeModification modification,
}
@Override
protected void checkSubtreeModificationApplicable(final InstanceIdentifier path, final NodeModification modification,
- final Optional<TreeNode> current) throws Data
Precondi
tionFailedException {
- check
DataPrecondition
(path, current.isPresent(), "Node was deleted by other transaction.");
+ final Optional<TreeNode> current) throws Data
Valida
tionFailedException {
+ check
Conflicting
(path, current.isPresent(), "Node was deleted by other transaction.");
checkChildPreconditions(path, modification, current);
}
checkChildPreconditions(path, modification, current);
}
- private void checkChildPreconditions(final InstanceIdentifier path, final NodeModification modification, final Optional<TreeNode> current) throws Data
Precondi
tionFailedException {
+ private void checkChildPreconditions(final InstanceIdentifier path, final NodeModification modification, final Optional<TreeNode> current) throws Data
Valida
tionFailedException {
final TreeNode currentMeta = current.get();
for (NodeModification childMod : modification.getChildren()) {
final PathArgument childId = childMod.getIdentifier();
final Optional<TreeNode> childMeta = currentMeta.getChild(childId);
final TreeNode currentMeta = current.get();
for (NodeModification childMod : modification.getChildren()) {
final PathArgument childId = childMod.getIdentifier();
final Optional<TreeNode> childMeta = currentMeta.getChild(childId);
- InstanceIdentifier childPath =
StoreUtils.append(path,
childId);
+ InstanceIdentifier childPath =
path.node(
childId);
resolveChildOperation(childId).checkApplicable(childPath, childMod, childMeta);
}
}
@Override
protected void checkMergeApplicable(final InstanceIdentifier path, final NodeModification modification,
resolveChildOperation(childId).checkApplicable(childPath, childMod, childMeta);
}
}
@Override
protected void checkMergeApplicable(final InstanceIdentifier path, final NodeModification modification,
- final Optional<TreeNode> current) throws Data
Precondi
tionFailedException {
+ final Optional<TreeNode> current) throws Data
Valida
tionFailedException {
if(current.isPresent()) {
checkChildPreconditions(path, modification,current);
}
if(current.isPresent()) {
checkChildPreconditions(path, modification,current);
}