import com.google.common.annotations.Beta;
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;
/**
* Utility class holding methods useful when dealing with {@link DataTreeCandidate} instances.
*/
@Beta
public final class DataTreeCandidates {
+ private static final Logger LOG = LoggerFactory.getLogger(DataTreeCandidates.class);
private DataTreeCandidates() {
throw new UnsupportedOperationException();
}
switch (node.getModificationType()) {
case DELETE:
modification.delete(path);
+ LOG.debug("Modification {} deleted path {}", modification, path);
break;
case SUBTREE_MODIFIED:
+ LOG.debug("Modification {} modified path {}", modification, path);
for (DataTreeCandidateNode child : node.getChildNodes()) {
applyNode(modification, path.node(child.getIdentifier()), child);
}
break;
case UNMODIFIED:
+ LOG.debug("Modification {} unmodified path {}", modification, path);
// No-op
break;
case WRITE:
modification.write(path, node.getDataAfter().get());
+ LOG.debug("Modification {} written path {}", modification, path);
break;
default:
throw new IllegalArgumentException("Unsupported modification " + node.getModificationType());
final Optional<TreeNode> newRoot = m.getStrategy().apply(m.getRootModification(),
Optional.<TreeNode>of(currentRoot), m.getVersion());
- Preconditions.checkState(newRoot.isPresent(), "Apply strategy failed to produce root node");
+ Preconditions.checkState(newRoot.isPresent(), "Apply strategy failed to produce root node for modification %s", modification);
return new InMemoryDataTreeCandidate(PUBLIC_ROOT_PATH, root, currentRoot, newRoot.get());
}
}