import com.google.common.collect.ForwardingObject;
import com.google.common.util.concurrent.FluentFuture;
import java.util.Optional;
-import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
import org.opendaylight.mdsal.binding.api.WriteTransaction;
public static ReadWriteTransaction toReadWriteTransaction(
final TypedReadWriteTransaction<? extends Datastore> datastoreTx) {
if (datastoreTx instanceof TypedReadWriteTransactionImpl) {
- TypedReadWriteTransactionImpl<?> nonSubmitCancelableDatastoreReadWriteTransaction =
- (TypedReadWriteTransactionImpl<?>) datastoreTx;
- return new ReadWriteTransactionAdapter<>(nonSubmitCancelableDatastoreReadWriteTransaction.datastoreType,
- nonSubmitCancelableDatastoreReadWriteTransaction);
+ final TypedReadWriteTransactionImpl<?> txImpl = (TypedReadWriteTransactionImpl<?>) datastoreTx;
+ return new ReadWriteTransactionAdapter<>(txImpl.getDatastoreType(), txImpl);
}
- throw new IllegalArgumentException(
- "Unsupported TypedWriteTransaction implementation " + datastoreTx.getClass());
+ throw new IllegalArgumentException("Unsupported TypedWriteTransaction implementation "
+ + datastoreTx.getClass());
}
/**
*/
public static WriteTransaction toWriteTransaction(final TypedWriteTransaction<? extends Datastore> datastoreTx) {
if (datastoreTx instanceof TypedWriteTransactionImpl) {
- TypedWriteTransactionImpl<?> nonSubmitCancelableDatastoreWriteTransaction =
- (TypedWriteTransactionImpl<?>) datastoreTx;
- return new WriteTransactionAdapter<>(nonSubmitCancelableDatastoreWriteTransaction.datastoreType,
- nonSubmitCancelableDatastoreWriteTransaction);
+ final TypedWriteTransactionImpl<?, ?> txImpl = (TypedWriteTransactionImpl<?, ?>) datastoreTx;
+ return new WriteTransactionAdapter<>(txImpl.getDatastoreType(), txImpl);
}
- throw new IllegalArgumentException(
- "Unsupported TypedWriteTransaction implementation " + datastoreTx.getClass());
+ throw new IllegalArgumentException("Unsupported TypedWriteTransaction implementation "
+ + datastoreTx.getClass());
}
private static class WriteTransactionAdapter<S extends Datastore, D extends TypedWriteTransaction<S>>
}
@Override
- public <T extends DataObject> void put(final LogicalDatastoreType store, final InstanceIdentifier<T> path,
- final T data, final boolean createMissingParents) {
+ public <T extends DataObject> void mergeParentStructurePut(final LogicalDatastoreType store,
+ final InstanceIdentifier<T> path, final T data) {
checkStore(store);
- delegate.put(path, data, createMissingParents);
+ delegate.mergeParentStructurePut(path, data);
}
@Override
}
@Override
- public <T extends DataObject> void merge(final LogicalDatastoreType store, final InstanceIdentifier<T> path,
- final T data, final boolean createMissingParents) {
+ public <T extends DataObject> void mergeParentStructureMerge(final LogicalDatastoreType store,
+ final InstanceIdentifier<T> path, final T data) {
checkStore(store);
- delegate.merge(path, data, createMissingParents);
+ delegate.mergeParentStructureMerge(path, data);
}
@Override
}
@Override
- public @NonNull FluentFuture<? extends CommitInfo> commit() {
+ public FluentFuture<? extends CommitInfo> commit() {
throw new UnsupportedOperationException("Managed transactions must not be committed");
}
return delegate.getIdentifier();
}
+ @Override
+ public FluentFuture<?> completionFuture() {
+ return delegate.completionFuture();
+ }
+
@Override
protected D delegate() {
return delegate;
checkStore(store);
return delegate().read(path);
}
+
+ @Override
+ public FluentFuture<Boolean> exists(final LogicalDatastoreType store,final InstanceIdentifier<?> path) {
+ checkStore(store);
+ return delegate().exists(path);
+ }
}
}