Bump to odlparent-9.0.0/yangtools-7.0.1-SNAPSHOT
[mdsal.git] / dom / mdsal-dom-api / src / main / java / org / opendaylight / mdsal / dom / api / DOMDataTreeReadOperations.java
1 /*
2  * Copyright (c) 2018 Pantheon Technologies. 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.dom.api;
9
10 import com.google.common.util.concurrent.FluentFuture;
11 import java.util.Optional;
12 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
13 import org.opendaylight.mdsal.common.api.ReadFailedException;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
16
17 public interface DOMDataTreeReadOperations {
18     /**
19      * Reads data from provided logical data store located at the provided path.
20      *
21      *<p>
22      * If the target is a subtree, then the whole subtree is read (and will be accessible from the returned data
23      * object).
24      *
25      * @param store Logical data store from which read should occur.
26      * @param path Path which uniquely identifies subtree which client want to read
27      * @return a FluentFuture containing the result of the read. The Future blocks until the commit operation is
28      *         complete. Once complete:
29      *         <ul>
30      *         <li>If the data at the supplied path exists, the Future returns an Optional object containing the data.
31      *         </li>
32      *         <li>If the data at the supplied path does not exist, the Future returns Optional.empty().</li>
33      *         <li>If the read of the data fails, the Future will fail with a {@link ReadFailedException} or
34      *         an exception derived from ReadFailedException.</li>
35      *         </ul>
36      */
37     FluentFuture<Optional<NormalizedNode>> read(LogicalDatastoreType store, YangInstanceIdentifier path);
38
39     /**
40      * Checks if data is available in the logical data store located at provided path.
41      *
42      * <p>
43      * Note: a successful result from this method makes no guarantee that a subsequent call to {@link #read} will
44      * succeed. It is possible that the data resides in a data store on a remote node and, if that node goes down or
45      * a network failure occurs, a subsequent read would fail. Another scenario is if the data is deleted in between
46      * the calls to <code>exists</code> and <code>read</code>
47      *
48      * @param store Logical data store from which read should occur.
49      * @param path Path which uniquely identifies subtree which client want to check existence of
50      * @return a FluentFuture containing the result of the check.
51      *         <ul>
52      *         <li>If the data at the supplied path exists, the Future returns a Boolean whose value is true,
53      *         false otherwise</li>
54      *         <li>If checking for the data fails, the Future will fail with a {@link ReadFailedException} or
55      *         an exception derived from ReadFailedException.</li>
56      *         </ul>
57      */
58     FluentFuture<Boolean> exists(LogicalDatastoreType store, YangInstanceIdentifier path);
59 }