Fix warnings/javadocs in sal-distributed-datastore
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / config / yang / config / distributed_datastore_provider / ForwardingDistributedDataStore.java
1 /*
2  * Copyright (c) 2016 Brocade Communications Systems, Inc. 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.config.yang.config.distributed_datastore_provider;
9
10 import com.google.common.collect.ForwardingObject;
11 import org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface;
12 import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
13 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
14 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
15 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
16 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
17 import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
18 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
19 import org.opendaylight.yangtools.concepts.ListenerRegistration;
20 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
21 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
22
23 /**
24  * DOMStore implementation that forwards to a delegate.
25  *
26  * @author Thomas Pantelis
27  */
28 class ForwardingDistributedDataStore extends ForwardingObject implements DistributedDataStoreInterface, AutoCloseable {
29     private final DistributedDataStoreInterface delegate;
30     private final AutoCloseable closeable;
31
32     ForwardingDistributedDataStore(DistributedDataStoreInterface delegate, AutoCloseable closeable) {
33         this.delegate = delegate;
34         this.closeable = closeable;
35     }
36
37     @Override
38     public DOMStoreReadTransaction newReadOnlyTransaction() {
39         return delegate().newReadOnlyTransaction();
40     }
41
42     @Override
43     public DOMStoreWriteTransaction newWriteOnlyTransaction() {
44         return delegate().newWriteOnlyTransaction();
45     }
46
47     @Override
48     public DOMStoreReadWriteTransaction newReadWriteTransaction() {
49         return delegate().newReadWriteTransaction();
50     }
51
52     @Override
53     public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L>
54             registerChangeListener(YangInstanceIdentifier path, L listener, DataChangeScope scope) {
55         return delegate().registerChangeListener(path, listener, scope);
56     }
57
58     @Override
59     public DOMStoreTransactionChain createTransactionChain() {
60         return delegate().createTransactionChain();
61     }
62
63     @Override
64     public ActorContext getActorContext() {
65         return delegate().getActorContext();
66     }
67
68     @Override
69     public void close() throws Exception {
70         closeable.close();
71     }
72
73     @Override
74     protected DistributedDataStoreInterface delegate() {
75         return delegate;
76     }
77 }