719a6f0499d4423040e5547b82a3bc957c30abbe
[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 org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
11 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
12 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
13
14 import com.google.common.base.Optional;
15 import com.google.common.util.concurrent.CheckedFuture;
16
17 public interface DOMStoreReadTransaction extends DOMStoreTransaction {
18
19     /**
20      * Reads data from provided logical data store located at provided path
21      *
22      * @param path
23      *            Path which uniquely identifies subtree which client want to
24      *            read
25      * @return a CheckFuture containing the result of the read. The Future blocks until the
26      *         commit operation is complete. Once complete:
27      *         <ul>
28      *         <li>If the data at the supplied path exists, the Future returns an Optional object
29      *         containing the data.</li>
30      *         <li>If the data at the supplied path does not exist, the Future returns
31      *         Optional#absent().</li>
32      *         <li>If the read of the data fails, the Future will fail with a
33      *         {@link ReadFailedException} or an exception derived from ReadFailedException.</li>
34      *         </ul>
35      */
36     CheckedFuture<Optional<NormalizedNode<?,?>>, ReadFailedException> read(YangInstanceIdentifier path);
37
38     /**
39      * Checks if data is available in the logical data store located at provided path
40      *
41      * @param path
42      *            Path which uniquely identifies subtree which client want to
43      *            check existence of
44      * @return a CheckFuture containing the result of the check.
45      *         <ul>
46      *         <li>If the data at the supplied path exists, the Future returns a Boolean
47      *         whose value is true, false otherwise</li>
48      *         <li>If checking for the data fails, the Future will fail with a
49      *         {@link ReadFailedException} or an exception derived from ReadFailedException.</li>
50      *         </ul>
51      */
52     CheckedFuture<Boolean, ReadFailedException> exists(YangInstanceIdentifier path);
53 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.