Clean up (DOM)DataTreeIdentifier methods
[mdsal.git] / binding / mdsal-binding-api / src / main / java / org / opendaylight / mdsal / binding / api / QueryOperations.java
1 /*
2  * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others.  All rights reserved.
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.api;
9
10 import com.google.common.util.concurrent.FluentFuture;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.mdsal.binding.api.query.QueryExpression;
13 import org.opendaylight.mdsal.binding.api.query.QueryResult;
14 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
15 import org.opendaylight.mdsal.common.api.ReadFailedException;
16 import org.opendaylight.mdsal.common.api.TransactionDatastoreMismatchException;
17 import org.opendaylight.yangtools.yang.binding.DataObject;
18
19 /**
20  * Query-like operations supported by {@link ReadTransaction} and {@link ReadWriteTransaction}. This interface defines
21  * the operations without a tie-in with lifecycle management.
22  */
23 public interface QueryOperations {
24     /**
25      * Executes a query on the provided logical data store.
26      *
27      * @param store Logical data store from which read should occur.
28      * @param query Query to execute
29      * @return a FluentFuture containing the result of the query. The Future blocks until the operation is complete.
30      *         Once complete:
31      *         <ul>
32      *           <li>The Future returns the result of the query</li>
33      *           <li>If the query execution fails, the Future will fail with a {@link ReadFailedException} or
34      *               an exception derived from ReadFailedException.
35      *            </li>
36      *         </ul>
37      * @throws IllegalArgumentException if the query is not supported
38      * @throws NullPointerException if any of the arguments is {@code null}
39      * @throws TransactionDatastoreMismatchException if this transaction is already bound to a different data store
40      */
41     <T extends @NonNull DataObject> @NonNull FluentFuture<QueryResult<T>> execute(@NonNull LogicalDatastoreType store,
42         @NonNull QueryExpression<T> query);
43 }