b7d4a144c54d2bf8a562d0ffd00f28a8edae724b
[mdsal.git] / dom / mdsal-dom-spi / src / main / java / org / opendaylight / mdsal / dom / spi / store / ForwardingDOMStoreThreePhaseCommitCohort.java
1 /*
2  * Copyright (c) 2015 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.mdsal.dom.spi.store;
9
10 import com.google.common.annotations.Beta;
11 import com.google.common.collect.ForwardingObject;
12 import com.google.common.util.concurrent.ListenableFuture;
13
14 /**
15  * Abstract base class for {@link DOMStoreThreePhaseCommitCohort} implementations,
16  * which forward most of their functionality to a backend {@link #delegate()}.
17  */
18 @Beta
19 public abstract class ForwardingDOMStoreThreePhaseCommitCohort
20         extends ForwardingObject implements DOMStoreThreePhaseCommitCohort {
21
22     @Override
23     protected abstract DOMStoreThreePhaseCommitCohort delegate();
24
25     @Override
26     public ListenableFuture<Boolean> canCommit() {
27         return delegate().canCommit();
28     }
29
30     @Override
31     public ListenableFuture<Void> preCommit() {
32         return delegate().preCommit();
33     }
34
35     @Override
36     public ListenableFuture<Void> abort() {
37         return delegate().abort();
38     }
39
40     @Override
41     public ListenableFuture<Void> commit() {
42         return delegate().commit();
43     }
44 }