4f19381edd78afb3356a3a935e08d102181719d1
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / databroker / DOMStoreThreePhaseCommitCohortAdaptor.java
1 /*
2  * Copyright (c) 2016 Cisco 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.cluster.databroker;
9
10 import static java.util.Objects.requireNonNull;
11
12 import com.google.common.collect.ForwardingObject;
13 import com.google.common.util.concurrent.ListenableFuture;
14 import org.opendaylight.mdsal.dom.spi.store.DOMStoreThreePhaseCommitCohort;
15
16 /**
17  * Utility class from bridging {@link DOMStoreThreePhaseCommitCohort} and
18  * {@link org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort}.
19  *
20  * @author Robert Varga
21  */
22 final class DOMStoreThreePhaseCommitCohortAdaptor extends ForwardingObject implements DOMStoreThreePhaseCommitCohort {
23     private final org.opendaylight.mdsal.dom.spi.store.DOMStoreThreePhaseCommitCohort delegate;
24
25     DOMStoreThreePhaseCommitCohortAdaptor(
26         final org.opendaylight.mdsal.dom.spi.store.DOMStoreThreePhaseCommitCohort delegate) {
27         this.delegate = requireNonNull(delegate);
28     }
29
30     @Override
31     public ListenableFuture<Boolean> canCommit() {
32         return delegate.canCommit();
33     }
34
35     @Override
36     public ListenableFuture<Void> preCommit() {
37         return delegate.preCommit();
38     }
39
40     @Override
41     public ListenableFuture<Void> abort() {
42         return delegate.abort();
43     }
44
45     @Override
46     public ListenableFuture<Void> commit() {
47         return delegate.commit();
48     }
49
50     @Override
51     protected Object delegate() {
52         return delegate;
53     }
54 }