Proxy MD-SAL interfaces in DOMMountPointServiceImpl
[controller.git] / opendaylight / md-sal / sal-dom-compat / src / main / java / org / opendaylight / controller / sal / core / compat / DOMDataTreeReadTransactionAdapter.java
1 /*
2  * Copyright (c) 2018 Pantheon Technologies, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.sal.core.compat;
9
10 import static java.util.Objects.requireNonNull;
11
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.DOMDataReadOnlyTransaction;
16 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
17 import org.opendaylight.mdsal.dom.api.DOMDataTreeReadTransaction;
18 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
19 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
20
21 public class DOMDataTreeReadTransactionAdapter extends ForwardingObject implements DOMDataTreeReadTransaction {
22     private final DOMDataReadOnlyTransaction delegate;
23
24     public DOMDataTreeReadTransactionAdapter(final DOMDataReadOnlyTransaction delegate) {
25         this.delegate = requireNonNull(delegate);
26     }
27
28     @Override
29     public Object getIdentifier() {
30         return delegate().getIdentifier();
31     }
32
33     @Override
34     public FluentFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store,
35             final YangInstanceIdentifier path) {
36         return TransactionUtils.read(delegate(), store, path);
37     }
38
39     @Override
40     public FluentFuture<Boolean> exists(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
41         return TransactionUtils.exists(delegate(), store, path);
42     }
43
44     @Override
45     public void close() {
46         delegate().close();
47     }
48
49     @Override
50     protected DOMDataReadOnlyTransaction delegate() {
51         return delegate;
52     }
53 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.