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.yangtools.yang.data.api.YangInstanceIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
17 public interface DOMDataTreeReadOperations {
19 * Reads data from provided logical data store located at the provided path.
22 * If the target is a subtree, then the whole subtree is read (and will be accessible from the returned data
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:
30 * <li>If the data at the supplied path exists, the Future returns an Optional object containing the data.
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>
37 FluentFuture<Optional<NormalizedNode<?,?>>> read(LogicalDatastoreType store, YangInstanceIdentifier path);
40 * Checks if data is available in the logical data store located at provided path.
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>
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.
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>
58 FluentFuture<Boolean> exists(LogicalDatastoreType store, YangInstanceIdentifier path);