Fix checkstyle violations in sal-dom-spi
[controller.git] / opendaylight / md-sal / sal-dom-spi / src / main / java / org / opendaylight / controller / sal / core / spi / data / DOMStoreReadTransaction.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.sal.core.spi.data;
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.ReadFailedException;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
14 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
15
16 public interface DOMStoreReadTransaction extends DOMStoreTransaction {
17
18     /**
19      * Reads data from provided logical data store located at provided path.
20      *
21      * @param path
22      *            Path which uniquely identifies subtree which client want to
23      *            read
24      * @return a CheckFuture containing the result of the read. The Future blocks until the
25      *         commit operation is complete. Once complete:
26      *         <ul>
27      *         <li>If the data at the supplied path exists, the Future returns an Optional object
28      *         containing the data.</li>
29      *         <li>If the data at the supplied path does not exist, the Future returns
30      *         Optional#absent().</li>
31      *         <li>If the read of the data fails, the Future will fail with a
32      *         {@link ReadFailedException} or an exception derived from ReadFailedException.</li>
33      *         </ul>
34      */
35     CheckedFuture<Optional<NormalizedNode<?,?>>, ReadFailedException> read(YangInstanceIdentifier path);
36
37     /**
38      * Checks if data is available in the logical data store located at provided path.
39      *
40      * <p>
41      * Note: a successful result from this method makes no guarantee that a subsequent call to {@link #read}
42      * will succeed. It is possible that the data resides in a data store on a remote node and, if that
43      * node goes down or a network failure occurs, a subsequent read would fail. Another scenario is if
44      * the data is deleted in between the calls to <code>exists</code> and <code>read</code>
45      *
46      * @param path
47      *            Path which uniquely identifies subtree which client want to
48      *            check existence of
49      * @return a CheckFuture containing the result of the check.
50      *         <ul>
51      *         <li>If the data at the supplied path exists, the Future returns a Boolean
52      *         whose value is true, false otherwise</li>
53      *         <li>If checking for the data fails, the Future will fail with a
54      *         {@link ReadFailedException} or an exception derived from ReadFailedException.</li>
55      *         </ul>
56      */
57     CheckedFuture<Boolean, ReadFailedException> exists(YangInstanceIdentifier path);
58 }