Merge "Bug 9092: revert to org.json temporarily"
[netconf.git] / restconf / sal-rest-connector / src / main / java / org / opendaylight / restconf / handlers / TransactionChainHandler.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
9 package org.opendaylight.restconf.handlers;
10
11 import com.google.common.base.Preconditions;
12 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
13
14
15 /**
16  * Implementation of {@link TransactionChainHandler}.
17  *
18  */
19 public class TransactionChainHandler implements Handler<DOMTransactionChain> {
20
21     private DOMTransactionChain transactionChain;
22
23     /**
24      * Prepare transaction chain service for Restconf services.
25      *
26      * @param transactionChain Transaction chain
27      */
28     public TransactionChainHandler(final DOMTransactionChain transactionChain) {
29         Preconditions.checkNotNull(transactionChain);
30         this.transactionChain = transactionChain;
31     }
32
33     @Override
34     public void update(final DOMTransactionChain transactionChain) {
35         Preconditions.checkNotNull(transactionChain);
36         this.transactionChain = transactionChain;
37     }
38
39     @Override
40     public DOMTransactionChain get() {
41         return this.transactionChain;
42     }
43 }