Migrate OSGI compendium reference
[controller.git] / opendaylight / md-sal / sal-dom-compat / src / main / java / org / opendaylight / controller / sal / core / compat / DOMStoreTransactionChainAdapter.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 org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
14 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
15 import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
16 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
17
18 @Deprecated(forRemoval = true)
19 public class DOMStoreTransactionChainAdapter extends ForwardingObject implements DOMStoreTransactionChain {
20     private final org.opendaylight.mdsal.dom.spi.store.DOMStoreTransactionChain delegate;
21
22     public DOMStoreTransactionChainAdapter(
23             final org.opendaylight.mdsal.dom.spi.store.DOMStoreTransactionChain delegate) {
24         this.delegate = requireNonNull(delegate);
25     }
26
27     @Override
28     protected org.opendaylight.mdsal.dom.spi.store.DOMStoreTransactionChain delegate() {
29         return delegate;
30     }
31
32     @Override
33     public DOMStoreWriteTransaction newWriteOnlyTransaction() {
34         return new DOMStoreWriteTransactionAdapter(delegate.newWriteOnlyTransaction());
35     }
36
37     @Override
38     public DOMStoreReadWriteTransaction newReadWriteTransaction() {
39         return new DOMStoreReadWriteTransactionAdapter(delegate.newReadWriteTransaction());
40     }
41
42     @Override
43     public DOMStoreReadTransaction newReadOnlyTransaction() {
44         return new DOMStoreReadTransactionAdapter<>(delegate.newReadOnlyTransaction());
45     }
46
47     @Override
48     public void close() {
49         delegate.close();
50     }
51 }