2 * Copyright (c) 2018 Pantheon Technologies. 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.mdsal.dom.api;
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.mdsal.common.api.TransactionDatastoreMismatchException;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
16 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
18 public interface DOMDataTreeReadOperations {
20 * Reads data from provided logical data store located at the provided path.
23 * If the target is a subtree, then the whole subtree is read (and will be accessible from the returned data
26 * @param store Logical data store from which read should occur.
27 * @param path Path which uniquely identifies subtree which client want to read
28 * @return a FluentFuture containing the result of the read. The Future blocks until the commit operation is
29 * complete. Once complete:
31 * <li>If the data at the supplied path exists, the Future returns an Optional object containing the data.
33 * <li>If the data at the supplied path does not exist, the Future returns Optional.empty().</li>
34 * <li>If the read of the data fails, the Future will fail with a {@link ReadFailedException} or
35 * an exception derived from ReadFailedException.</li>
37 * @throws IllegalArgumentException if {@code store} is not supported
38 * @throws NullPointerException if any argument is {@code null}
39 * @throws TransactionDatastoreMismatchException if this transaction is already bound to a different data store
41 FluentFuture<Optional<NormalizedNode>> read(LogicalDatastoreType store, YangInstanceIdentifier path);
44 * Checks if data is available in the logical data store located at provided path.
47 * Note: a successful result from this method makes no guarantee that a subsequent call to {@link #read} will
48 * succeed. It is possible that the data resides in a data store on a remote node and, if that node goes down or
49 * a network failure occurs, a subsequent read would fail. Another scenario is if the data is deleted in between
50 * the calls to <code>exists</code> and <code>read</code>
52 * @param store Logical data store from which read should occur.
53 * @param path Path which uniquely identifies subtree which client want to check existence of
54 * @return a FluentFuture containing the result of the check.
56 * <li>If the data at the supplied path exists, the Future returns a Boolean whose value is true,
57 * false otherwise</li>
58 * <li>If checking for the data fails, the Future will fail with a {@link ReadFailedException} or
59 * an exception derived from ReadFailedException.</li>
61 * @throws IllegalArgumentException if {@code store} is not supported
62 * @throws NullPointerException if any argument is {@code null}
63 * @throws TransactionDatastoreMismatchException if this transaction is already bound to a different data store
65 FluentFuture<Boolean> exists(LogicalDatastoreType store, YangInstanceIdentifier path);