2 * Copyright (c) 2015 Cisco Systems, Inc. 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.base.Optional;
11 import com.google.common.util.concurrent.CheckedFuture;
12 import javax.annotation.Nonnull;
13 import org.opendaylight.mdsal.common.api.ReadFailedException;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
15 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
17 public interface DOMDataTreeReadCursor extends DOMDataTreeCursor {
20 * Read a particular node from the snapshot.
22 * @param child Child identifier
23 * @return Optional result encapsulating the presence and value of the node
24 * @throws IllegalArgumentException when specified path does not identify a valid child.
26 CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> readNode(@Nonnull PathArgument child);
29 * Checks if data is available in the logical data store located at provided path.
32 * Note: a successful result from this method makes no guarantee that a subsequent call to
33 * {@link #readNode(PathArgument)} will succeed. It is possible that the data resides in a data store on a remote
34 * node and, if that node goes down or a network failure occurs, a subsequent read would fail.
35 * Another scenario is if the data is deleted in between the calls to <code>exists</code> and
36 * <code>readNode</code>
38 * @param child Child identifier
39 * @return a CheckFuture containing the result of the check.
41 * <li>If the data at the supplied path exists, the Future returns a Boolean whose value
42 * is true, false otherwise</li> <li>If checking for the data fails, the Future will
43 * fail with a {@link ReadFailedException} or an exception derived from
44 * ReadFailedException.</li>
47 CheckedFuture<Boolean, ReadFailedException> exists(@Nonnull PathArgument child);