1a47990ddf1bfe8afd7d89abc30498eb9436199c
[controller.git] / opendaylight / md-sal / sal-dom-api / src / main / java / org / opendaylight / controller / md / sal / dom / api / DOMDataReadTransaction.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. 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.controller.md.sal.dom.api;
9
10 import com.google.common.base.Optional;
11 import com.google.common.util.concurrent.CheckedFuture;
12 import org.opendaylight.controller.md.sal.common.api.data.AsyncReadTransaction;
13 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
14 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
16 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
17
18 /**
19  * A transaction that provides read access to a logical data store.
20  *
21  * <p>
22  * For more information on usage and examples, please see the documentation in {@link AsyncReadTransaction}.
23  *
24  * @deprecated Use {@link org.opendaylight.mdsal.dom.api.DOMDataTreeReadTransaction} instead.
25  */
26 @Deprecated
27 public interface DOMDataReadTransaction extends AsyncReadTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>> {
28     /**
29      * Reads data from provided logical data store located at the provided path.
30      *
31      * <p>
32      * If the target is a subtree, then the whole subtree is read (and will be
33      * accessible from the returned data object).
34      *
35      * @param store
36      *            Logical data store from which read should occur.
37      * @param path
38      *            Path which uniquely identifies subtree which client want to
39      *            read
40      * @return a CheckFuture containing the result of the read. The Future blocks until the
41      *         commit operation is complete. Once complete:
42      *         <ul>
43      *         <li>If the data at the supplied path exists, the Future returns an Optional object
44      *         containing the data.</li>
45      *         <li>If the data at the supplied path does not exist, the Future returns
46      *         Optional#absent().</li>
47      *         <li>If the read of the data fails, the Future will fail with a
48      *         {@link ReadFailedException} or an exception derived from ReadFailedException.</li>
49      *         </ul>
50      */
51     CheckedFuture<Optional<NormalizedNode<?,?>>, ReadFailedException> read(
52             LogicalDatastoreType store, YangInstanceIdentifier path);
53
54     /**
55      * Checks if data is available in the logical data store located at provided path.
56      *
57      * <p>
58      * Note: a successful result from this method makes no guarantee that a subsequent call to {@link #read}
59      * will succeed. It is possible that the data resides in a data store on a remote node and, if that
60      * node goes down or a network failure occurs, a subsequent read would fail. Another scenario is if
61      * the data is deleted in between the calls to <code>exists</code> and <code>read</code>
62      *
63      * @param store
64      *            Logical data store from which read should occur.
65      * @param path
66      *            Path which uniquely identifies subtree which client want to
67      *            check existence of
68      * @return a CheckFuture containing the result of the check.
69      *         <ul>
70      *         <li>If the data at the supplied path exists, the Future returns a Boolean
71      *         whose value is true, false otherwise</li>
72      *         <li>If checking for the data fails, the Future will fail with a
73      *         {@link ReadFailedException} or an exception derived from ReadFailedException.</li>
74      *         </ul>
75      */
76     CheckedFuture<Boolean, ReadFailedException> exists(LogicalDatastoreType store, YangInstanceIdentifier path);
77 }