Remove common.api.TransactionChain
[mdsal.git] / common / mdsal-common-util / src / main / java / org / opendaylight / mdsal / common / util / ForwardingAsyncReadWriteTransaction.java
1 /*
2  * Copyright © 2017, 2018 Red Hat, Inc. and others.
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.mdsal.common.util;
9
10 import com.google.common.collect.ForwardingObject;
11 import com.google.common.util.concurrent.FluentFuture;
12 import org.opendaylight.mdsal.common.api.AsyncReadWriteTransaction;
13 import org.opendaylight.mdsal.common.api.CommitInfo;
14 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
15 import org.opendaylight.yangtools.concepts.Path;
16
17 /**
18  * Utility {@link AsyncReadWriteTransaction} implementation which forwards all interface method
19  * invocation to a delegate instance.
20  */
21 public class ForwardingAsyncReadWriteTransaction<P extends Path<P>, D> extends ForwardingObject
22         implements AsyncReadWriteTransaction<P, D> {
23
24     private final AsyncReadWriteTransaction<P, D> delegate;
25
26     protected ForwardingAsyncReadWriteTransaction(AsyncReadWriteTransaction<P, D> delegate) {
27         this.delegate = delegate;
28     }
29
30     @Override
31     protected AsyncReadWriteTransaction<P, D> delegate() {
32         return delegate;
33     }
34
35     @Override
36     public Object getIdentifier() {
37         return delegate.getIdentifier();
38     }
39
40     @Override
41     public boolean cancel() {
42         return delegate.cancel();
43     }
44
45     @Override
46     public FluentFuture<? extends CommitInfo> commit() {
47         return delegate.commit();
48     }
49
50     @Override
51     public void delete(LogicalDatastoreType store, P path) {
52         delegate.delete(store, path);
53     }
54
55     @Override
56     public void close() {
57         delegate.close();
58     }
59 }