Proxy MD-SAL interfaces in DOMMountPointServiceImpl
[controller.git] / opendaylight / md-sal / sal-dom-compat / src / main / java / org / opendaylight / controller / sal / core / compat / DOMDataTreeWriteTransactionAdapter.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 org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
15 import org.opendaylight.mdsal.common.api.CommitInfo;
16 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
17 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
18 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
19 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
20
21 public class DOMDataTreeWriteTransactionAdapter extends ForwardingObject
22         implements DOMDataTreeWriteTransaction {
23     private final DOMDataWriteTransaction delegate;
24
25     public DOMDataTreeWriteTransactionAdapter(final DOMDataWriteTransaction delegate) {
26         this.delegate = requireNonNull(delegate);
27     }
28
29     @Override
30     public Object getIdentifier() {
31         return delegate().getIdentifier();
32     }
33
34     @Override
35     public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path,
36             final NormalizedNode<?, ?> data) {
37         TransactionUtils.put(delegate(), store, path, data);
38     }
39
40     @Override
41     public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path,
42             final NormalizedNode<?, ?> data) {
43         TransactionUtils.merge(delegate(), store, path, data);
44     }
45
46     @Override
47     public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
48         TransactionUtils.delete(delegate(), store, path);
49     }
50
51     @Override
52     public FluentFuture<? extends CommitInfo> commit() {
53         return delegate().commit();
54     }
55
56     @Override
57     public boolean cancel() {
58         return delegate().cancel();
59     }
60
61     @Override
62     protected DOMDataWriteTransaction delegate() {
63         return delegate;
64     }
65 }

©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.