import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
+import org.opendaylight.controller.cluster.datastore.utils.PruningDataTreeModification;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateTip;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
import org.slf4j.Logger;
@Override
public ListenableFuture<Boolean> canCommit() {
try {
- dataTree.getDataTree().validate(transaction);
+ dataTree.getDataTree().validate(dataTreeModification());
LOG.debug("Transaction {} validated", transaction);
return TRUE_FUTURE;
} catch (Exception e) {
@Override
public ListenableFuture<Void> preCommit() {
try {
- candidate = dataTree.getDataTree().prepare(transaction);
+ candidate = dataTree.getDataTree().prepare(dataTreeModification());
/*
* FIXME: this is the place where we should be interacting with persistence, specifically by invoking
* persist on the candidate (which gives us a Future).
}
}
+ private DataTreeModification dataTreeModification() {
+ DataTreeModification dataTreeModification = transaction;
+ if(transaction instanceof PruningDataTreeModification){
+ dataTreeModification = ((PruningDataTreeModification) transaction).getDelegate();
+ }
+ return dataTreeModification;
+ }
+
@Override
public ListenableFuture<Void> abort() {
// No-op, really