2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.netconf.sal.connect.netconf.sal.tx;
11 import com.google.common.util.concurrent.FluentFuture;
12 import java.util.Optional;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.opendaylight.mdsal.common.api.CommitInfo;
15 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
16 import org.opendaylight.mdsal.dom.api.DOMDataTreeReadTransaction;
17 import org.opendaylight.mdsal.dom.api.DOMDataTreeReadWriteTransaction;
18 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
19 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
20 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
22 public class ReadWriteTx<T extends DOMDataTreeReadTransaction> implements DOMDataTreeReadWriteTransaction {
23 private final DOMDataTreeWriteTransaction delegateWriteTx;
24 final T delegateReadTx;
26 public ReadWriteTx(final T delegateReadTx, final DOMDataTreeWriteTransaction delegateWriteTx) {
27 this.delegateReadTx = delegateReadTx;
28 this.delegateWriteTx = delegateWriteTx;
32 public final boolean cancel() {
33 return delegateWriteTx.cancel();
37 public final void put(final LogicalDatastoreType store, final YangInstanceIdentifier path,
38 final NormalizedNode data) {
39 delegateWriteTx.put(store, path, data);
43 public final void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path,
44 final NormalizedNode data) {
45 delegateWriteTx.merge(store, path, data);
49 public final void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
50 delegateWriteTx.delete(store, path);
54 public final FluentFuture<? extends @NonNull CommitInfo> commit() {
55 return delegateWriteTx.commit();
59 public final FluentFuture<Optional<NormalizedNode>> read(final LogicalDatastoreType store,
60 final YangInstanceIdentifier path) {
61 return delegateReadTx.read(store, path);
65 public final FluentFuture<Boolean> exists(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
66 return delegateReadTx.exists(store, path);
70 public final Object getIdentifier() {