Adopt odlparent-10.0.0/yangtools-8.0.0-SNAPSHOT
[mdsal.git] / dom / mdsal-dom-inmemory-datastore / src / main / java / org / opendaylight / mdsal / dom / store / inmemory / DOMStoreTransactionChainImpl.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.mdsal.dom.store.inmemory;
9
10 import static java.util.Objects.requireNonNull;
11
12 import org.opendaylight.mdsal.dom.spi.store.AbstractSnapshotBackedTransactionChain;
13 import org.opendaylight.mdsal.dom.spi.store.DOMStoreThreePhaseCommitCohort;
14 import org.opendaylight.mdsal.dom.spi.store.SnapshotBackedWriteTransaction;
15 import org.opendaylight.yangtools.yang.data.tree.api.DataTreeModification;
16 import org.opendaylight.yangtools.yang.data.tree.api.DataTreeSnapshot;
17
18 final class DOMStoreTransactionChainImpl extends AbstractSnapshotBackedTransactionChain<String> {
19     private final InMemoryDOMDataStore store;
20
21     DOMStoreTransactionChainImpl(final InMemoryDOMDataStore store) {
22         this.store = requireNonNull(store);
23     }
24
25     @Override
26     protected DOMStoreThreePhaseCommitCohort createCohort(final SnapshotBackedWriteTransaction<String> tx,
27                                                           final DataTreeModification modification,
28                                                           final Exception operationError) {
29         return new ChainedTransactionCommitImpl(store, tx, modification, this, operationError);
30     }
31
32     @Override
33     protected DataTreeSnapshot takeSnapshot() {
34         return store.takeSnapshot();
35     }
36
37     @Override
38     protected String nextTransactionIdentifier() {
39         return store.nextIdentifier();
40     }
41
42     @Override
43     protected boolean getDebugTransactions() {
44         return store.getDebugTransactions();
45     }
46
47     void transactionCommited(final SnapshotBackedWriteTransaction<String> transaction) {
48         super.onTransactionCommited(transaction);
49     }
50 }