2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.mdsal.dom.spi.store;
10 import com.google.common.annotations.Beta;
11 import org.opendaylight.mdsal.dom.spi.store.SnapshotBackedWriteTransaction.TransactionReadyPrototype;
12 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
15 * Public utility class for instantiating snapshot-backed transactions.
18 public final class SnapshotBackedTransactions {
19 private SnapshotBackedTransactions() {
20 throw new UnsupportedOperationException("Utility class");
24 * Creates a new read-only transaction.
25 * @param identifier Transaction Identifier
26 * @param debug Enable transaction debugging
27 * @param snapshot Snapshot which will be modified.
29 public static <T> SnapshotBackedReadTransaction<T> newReadTransaction(final T identifier,
30 final boolean debug, final DataTreeSnapshot snapshot) {
31 return new SnapshotBackedReadTransaction<>(identifier, debug, snapshot);
35 * Creates a new read-write transaction.
37 * @param identifier transaction Identifier
38 * @param debug Enable transaction debugging
39 * @param snapshot Snapshot which will be modified.
40 * @param readyImpl Implementation of ready method.
42 public static <T> SnapshotBackedReadWriteTransaction<T> newReadWriteTransaction(final T identifier,
43 final boolean debug, final DataTreeSnapshot snapshot, final TransactionReadyPrototype<T> readyImpl) {
44 return new SnapshotBackedReadWriteTransaction<>(identifier, debug, snapshot, readyImpl);
48 * Creates a new write-only transaction.
50 * @param identifier transaction Identifier
51 * @param debug Enable transaction debugging
52 * @param snapshot Snapshot which will be modified.
53 * @param readyImpl Implementation of ready method.
55 public static <T> SnapshotBackedWriteTransaction<T> newWriteTransaction(final T identifier,
56 final boolean debug, final DataTreeSnapshot snapshot, final TransactionReadyPrototype<T> readyImpl) {
57 return new SnapshotBackedWriteTransaction<>(identifier, debug, snapshot, readyImpl);