Fix javadoc warnings in mdsal-binding-util
[mdsal.git] / binding / mdsal-binding-util / src / main / java / org / opendaylight / mdsal / binding / util / 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.mdsal.binding.util;
9
10 import com.google.common.util.concurrent.FluentFuture;
11 import java.util.Optional;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.mdsal.binding.api.ReadTransaction;
14 import org.opendaylight.mdsal.binding.api.Transaction;
15 import org.opendaylight.mdsal.binding.api.query.QueryExpression;
16 import org.opendaylight.mdsal.binding.api.query.QueryResult;
17 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
18 import org.opendaylight.mdsal.common.api.ReadFailedException;
19 import org.opendaylight.yangtools.yang.binding.DataObject;
20 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
21
22 /**
23  * Read transaction which is specific to a single logical datastore (configuration or operational). Designed for use
24  * with {@link ManagedNewTransactionRunner} (it doesn’t support explicit cancel or commit operations).
25  *
26  * @see ReadTransaction
27  *
28  * @param <D> The logical datastore handled by the transaction.
29  */
30 public interface TypedReadTransaction<D extends Datastore> extends Transaction {
31     /**
32      * Reads an object from the given path.
33      *
34      * @see ReadTransaction#read(LogicalDatastoreType, InstanceIdentifier)
35      *
36      * @param path The path to read from.
37      * @param <T> The type of the expected object.
38      * @return A future providing access to the result of the read, when it’s available, or any error encountered.
39      */
40     <T extends DataObject> FluentFuture<Optional<T>> read(InstanceIdentifier<T> path);
41
42     /**
43      * Determines if an object exists at the given path.
44      *
45      * @see ReadTransaction#exists(LogicalDatastoreType, InstanceIdentifier)
46      *
47      * @param path The path to read from.
48      * @return A future providing access to the result of the check, when it’s available, or any error encountered.
49      */
50     FluentFuture<Boolean> exists(InstanceIdentifier<?> path);
51
52     /**
53      * Executes a {@link QueryExpression}.
54      *
55      * @param query Query to execute
56      * @param <T> The type of the expected object
57      * @return a FluentFuture containing the result of the query. The Future blocks until the operation is complete.
58      *         Once complete:
59      *         <ul>
60      *           <li>The Future returns the result of the query</li>
61      *           <li>If the query execution fails, the Future will fail with a {@link ReadFailedException} or
62      *               an exception derived from ReadFailedException.
63      *            </li>
64      *         </ul>
65      * @throws NullPointerException if any of the arguments is null
66      * @throws IllegalArgumentException if the query is not supported
67      */
68     <T extends @NonNull DataObject> FluentFuture<QueryResult<T>> execute(QueryExpression<T> query);
69 }