6bda7d6017923e1efdd54921afdea8d13399e120
[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 @Deprecated
22 public class DOMDataTreeWriteTransactionAdapter extends ForwardingObject
23         implements DOMDataTreeWriteTransaction {
24     private final DOMDataWriteTransaction delegate;
25
26     public DOMDataTreeWriteTransactionAdapter(final DOMDataWriteTransaction delegate) {
27         this.delegate = requireNonNull(delegate);
28     }
29
30     @Override
31     public Object getIdentifier() {
32         return delegate().getIdentifier();
33     }
34
35     @Override
36     public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path,
37             final NormalizedNode<?, ?> data) {
38         TransactionUtils.put(delegate(), store, path, data);
39     }
40
41     @Override
42     public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path,
43             final NormalizedNode<?, ?> data) {
44         TransactionUtils.merge(delegate(), store, path, data);
45     }
46
47     @Override
48     public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
49         TransactionUtils.delete(delegate(), store, path);
50     }
51
52     @Override
53     public FluentFuture<? extends CommitInfo> commit() {
54         return delegate().commit();
55     }
56
57     @Override
58     public boolean cancel() {
59         return delegate().cancel();
60     }
61
62     @Override
63     protected DOMDataWriteTransaction delegate() {
64         return delegate;
65     }
66 }

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