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 implements DOMDataTreeReadWriteTransaction {
24 private final DOMDataTreeReadTransaction delegateReadTx;
25 private final DOMDataTreeWriteTransaction delegateWriteTx;
27 public ReadWriteTx(final DOMDataTreeReadTransaction delegateReadTx,
28 final DOMDataTreeWriteTransaction delegateWriteTx) {
29 this.delegateReadTx = delegateReadTx;
30 this.delegateWriteTx = delegateWriteTx;
34 public boolean cancel() {
35 return delegateWriteTx.cancel();
44 public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path,
45 final NormalizedNode<?, ?> data) {
46 delegateWriteTx.put(store, path, data);
50 public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path,
51 final NormalizedNode<?, ?> data) {
52 delegateWriteTx.merge(store, path, data);
56 public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
57 delegateWriteTx.delete(store, path);
61 public FluentFuture<? extends @NonNull CommitInfo> commit() {
62 return delegateWriteTx.commit();
66 public FluentFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store,
67 final YangInstanceIdentifier path) {
68 return delegateReadTx.read(store, path);
72 public FluentFuture<Boolean> exists(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
73 return delegateReadTx.exists(store, path);
77 public Object getIdentifier() {