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.controller.sal.core.spi.data;
10 import com.google.common.annotations.Beta;
11 import org.opendaylight.controller.sal.core.spi.data.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.
26 * @param identifier Transaction Identifier
27 * @param debug Enable transaction debugging
28 * @param snapshot Snapshot which will be modified.
30 public static <T> SnapshotBackedReadTransaction<T> newReadTransaction(final T identifier, final boolean debug,
31 final DataTreeSnapshot snapshot) {
32 return new SnapshotBackedReadTransaction<>(identifier, debug, snapshot);
36 * Creates a new read-write transaction.
38 * @param identifier transaction Identifier
39 * @param debug Enable transaction debugging
40 * @param snapshot Snapshot which will be modified.
41 * @param readyImpl Implementation of ready method.
43 public static <T> SnapshotBackedReadWriteTransaction<T> newReadWriteTransaction(final T identifier,
44 final boolean debug, final DataTreeSnapshot snapshot, final TransactionReadyPrototype<T> readyImpl) {
45 return new SnapshotBackedReadWriteTransaction<>(identifier, debug, snapshot, readyImpl);
49 * Creates a new write-only transaction.
51 * @param identifier transaction Identifier
52 * @param debug Enable transaction debugging
53 * @param snapshot Snapshot which will be modified.
54 * @param readyImpl Implementation of ready method.
56 public static <T> SnapshotBackedWriteTransaction<T> newWriteTransaction(final T identifier, final boolean debug,
57 final DataTreeSnapshot snapshot, final TransactionReadyPrototype<T> readyImpl) {
58 return new SnapshotBackedWriteTransaction<>(identifier, debug, snapshot, readyImpl);