Merge "Bug-915: Adding static document generation. Currently the API Explorer can...
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / md / sal / dom / broker / impl / PingPongDataBroker.java
1 /*
2  * Copyright (c) 2014 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.md.sal.dom.broker.impl;
9
10 import com.google.common.base.Preconditions;
11 import javax.annotation.Nonnull;
12 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
13 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
14 import org.opendaylight.controller.md.sal.dom.spi.ForwardingDOMDataBroker;
15
16 /**
17  * An implementation of a {@link DOMDataBroker}, which forwards most requests to a delegate.
18  *
19  * Its interpretation of the API contract is somewhat looser, specifically it does not
20  * guarantee transaction ordering between transactions allocated directly from the broker
21  * and its transaction chains.
22  */
23 public final class PingPongDataBroker extends ForwardingDOMDataBroker implements AutoCloseable {
24     private final DOMDataBroker delegate;
25
26     /**
27      * Instantiate a new broker, backed by the the specified delegate
28      * {@link DOMDataBroker}.
29      *
30      * @param delegate Backend broker, may not be null.
31      */
32     public PingPongDataBroker(final @Nonnull DOMDataBroker delegate) {
33         this.delegate = Preconditions.checkNotNull(delegate);
34     }
35
36     @Override
37     protected DOMDataBroker delegate() {
38         return delegate;
39     }
40
41     @Override
42     public PingPongTransactionChain createTransactionChain(final TransactionChainListener listener) {
43         return new PingPongTransactionChain(delegate, listener);
44     }
45
46     @Override
47     public void close() {
48         // TODO Auto-generated method stub
49     }
50 }