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 static java.util.Objects.requireNonNull;
12 import com.google.common.annotations.Beta;
13 import org.opendaylight.controller.sal.core.spi.data.SnapshotBackedReadTransaction.TransactionClosePrototype;
14 import org.opendaylight.controller.sal.core.spi.data.SnapshotBackedWriteTransaction.TransactionReadyPrototype;
15 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
18 * Public utility class for instantiating snapshot-backed transactions.
20 * @deprecated Use {@link org.opendaylight.mdsal.dom.spi.store.SnapshotBackedTransactions} instead.
22 @Deprecated(forRemoval = true)
24 public final class SnapshotBackedTransactions {
25 private SnapshotBackedTransactions() {
26 throw new UnsupportedOperationException("Utility class");
30 * Creates a new read-only transaction.
32 * @param identifier Transaction Identifier
33 * @param debug Enable transaction debugging
34 * @param snapshot Snapshot which will be modified.
35 * @return A new read-only transaction
37 public static <T> SnapshotBackedReadTransaction<T> newReadTransaction(final T identifier, final boolean debug,
38 final DataTreeSnapshot snapshot) {
39 return new SnapshotBackedReadTransaction<>(identifier, debug, snapshot, null);
43 * Creates a new read-only transaction.
45 * @param identifier Transaction Identifier
46 * @param debug Enable transaction debugging
47 * @param snapshot Snapshot which will be modified.
48 * @param closeImpl Implementation of close method
49 * @return A new read-only transaction
51 public static <T> SnapshotBackedReadTransaction<T> newReadTransaction(final T identifier,
52 final boolean debug, final DataTreeSnapshot snapshot, final TransactionClosePrototype<T> closeImpl) {
53 return new SnapshotBackedReadTransaction<>(identifier, debug, snapshot, requireNonNull(closeImpl));
57 * Creates a new read-write transaction.
59 * @param identifier transaction Identifier
60 * @param debug Enable transaction debugging
61 * @param snapshot Snapshot which will be modified.
62 * @param readyImpl Implementation of ready method.
63 * @return A new read-write transaction
65 public static <T> SnapshotBackedReadWriteTransaction<T> newReadWriteTransaction(final T identifier,
66 final boolean debug, final DataTreeSnapshot snapshot, final TransactionReadyPrototype<T> readyImpl) {
67 return new SnapshotBackedReadWriteTransaction<>(identifier, debug, snapshot, readyImpl);
71 * Creates a new write-only transaction.
73 * @param identifier transaction Identifier
74 * @param debug Enable transaction debugging
75 * @param snapshot Snapshot which will be modified.
76 * @param readyImpl Implementation of ready method.
77 * @return A new write transaction
79 public static <T> SnapshotBackedWriteTransaction<T> newWriteTransaction(final T identifier, final boolean debug,
80 final DataTreeSnapshot snapshot, final TransactionReadyPrototype<T> readyImpl) {
81 return new SnapshotBackedWriteTransaction<>(identifier, debug, snapshot, readyImpl);