Deprecate ManagedNewTransactionRunner et al.
[genius.git] / mdsalutil / mdsalutil-api / src / main / java / org / opendaylight / genius / infra / TypedReadTransaction.java
1 /*
2  * Copyright © 2018 Red Hat, Inc. and others.
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.genius.infra;
9
10 import com.google.common.util.concurrent.FluentFuture;
11 import java.util.Optional;
12 import org.opendaylight.mdsal.binding.api.ReadTransaction;
13 import org.opendaylight.mdsal.binding.api.Transaction;
14 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
15 import org.opendaylight.yangtools.yang.binding.DataObject;
16 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
17
18 /**
19  * Read transaction which is specific to a single logical datastore (configuration or operational). Designed for use
20  * with {@link ManagedNewTransactionRunner} (it doesn’t support explicit cancel or commit operations).
21  *
22  * @see ReadTransaction
23  *
24  * @param <D> The logical datastore handled by the transaction.
25  * @deprecated Use {@link org.opendaylight.mdsal.binding.util.TypedReadTransaction} instead.
26  */
27 @Deprecated(forRemoval = true)
28 public interface TypedReadTransaction<D extends Datastore>
29         extends Transaction {
30     /**
31      * Reads an object from the given path.
32      *
33      * @see ReadTransaction#read(LogicalDatastoreType, InstanceIdentifier)
34      *
35      * @param path The path to read from.
36      * @param <T> The type of the expected object.
37      * @return A future providing access to the result of the read, when it’s available, or any error encountered.
38      */
39     <T extends DataObject> FluentFuture<Optional<T>> read(InstanceIdentifier<T> path);
40
41     /**
42      * Determines if an object exists at the given path.
43      *
44      * @see ReadTransaction#exists(LogicalDatastoreType, InstanceIdentifier)
45      *
46      * @param path The path to read from.
47      * @return A future providing access to the result of the check, when it’s available, or any error encountered.
48      */
49     FluentFuture<Boolean> exists(InstanceIdentifier<?> path);
50 }