2 * Copyright (c) 2018 Pantheon Technologies, s.r.o. 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
8 package org.opendaylight.controller.sal.core.compat;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.collect.ForwardingObject;
13 import com.google.common.util.concurrent.FluentFuture;
14 import java.util.Optional;
15 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
16 import org.opendaylight.mdsal.common.api.CommitInfo;
17 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
18 import org.opendaylight.mdsal.dom.api.DOMDataTreeReadWriteTransaction;
19 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
20 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
22 public class DOMDataTreeReadWriteTransactionAdapter extends ForwardingObject
23 implements DOMDataTreeReadWriteTransaction {
24 private final DOMDataReadWriteTransaction delegate;
26 public DOMDataTreeReadWriteTransactionAdapter(final DOMDataReadWriteTransaction delegate) {
27 this.delegate = requireNonNull(delegate);
31 public Object getIdentifier() {
32 return delegate().getIdentifier();
36 public FluentFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store,
37 final YangInstanceIdentifier path) {
38 return TransactionUtils.read(delegate(), store, path);
42 public FluentFuture<Boolean> exists(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
43 return TransactionUtils.exists(delegate(), store, path);
52 public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path,
53 final NormalizedNode<?, ?> data) {
54 TransactionUtils.put(delegate(), store, path, data);
58 public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path,
59 final NormalizedNode<?, ?> data) {
60 TransactionUtils.merge(delegate(), store, path, data);
64 public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
65 TransactionUtils.delete(delegate(), store, path);
69 public FluentFuture<? extends CommitInfo> commit() {
70 return delegate().commit();
74 public boolean cancel() {
75 return delegate().cancel();
79 protected DOMDataReadWriteTransaction delegate() {