Initial opendaylight infrastructure commit!!
[controller.git] / opendaylight / sal / yang-prototype / sal / sal-core-api / src / main / java / org / opendaylight / controller / sal / core / api / data / DataBrokerService.java
1 /*\r
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
3  *\r
4  * This program and the accompanying materials are made available under the\r
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7  */\r
8 package org.opendaylight.controller.sal.core.api.data;\r
9 \r
10 import java.util.concurrent.Future;\r
11 \r
12 import org.opendaylight.controller.sal.common.DataStoreIdentifier;\r
13 import org.opendaylight.controller.sal.core.api.BrokerService;\r
14 import org.opendaylight.controller.sal.core.api.Consumer;\r
15 import org.opendaylight.controller.sal.core.api.Provider;\r
16 import org.opendaylight.controller.yang.common.RpcResult;\r
17 import org.opendaylight.controller.yang.data.api.CompositeNode;\r
18 import org.opendaylight.controller.yang.data.api.CompositeNodeModification;\r
19 import org.opendaylight.controller.yang.data.api.Node;\r
20 \r
21 \r
22 /**\r
23  * DataBrokerService provides unified access to the data stores available in the\r
24  * system.\r
25  * \r
26  * \r
27  * @see DataProviderService\r
28  * \r
29  */\r
30 public interface DataBrokerService extends BrokerService {\r
31 \r
32     /**\r
33      * Returns a data from specified Data Store.\r
34      * \r
35      * Returns all the data visible to the consumer from specified Data Store.\r
36      * \r
37      * @param store\r
38      *            Identifier of the store, from which will be data retrieved\r
39      * @return data visible to the consumer\r
40      */\r
41     CompositeNode getData(DataStoreIdentifier store);\r
42 \r
43     /**\r
44      * Returns a filtered subset of data from specified Data Store.\r
45      * \r
46      * <p>\r
47      * The filter is modeled as an hierarchy of {@link Node} starting with\r
48      * {@link CompositeNode} representing data root. The semantics of the filter\r
49      * tree is the same as filter semantics defined in the NETCONF protocol for\r
50      * rpc operations <code>get</code> and <code>get-config</code> in Section 6\r
51      * of RFC6241.\r
52      * \r
53      * \r
54      * @see http://tools.ietf.org/html/rfc6241#section-6\r
55      * @param store\r
56      *            Identifier of the store, from which will be data retrieved\r
57      * @param filter\r
58      *            Data tree filter similar to the NETCONF filter\r
59      * @return\r
60      */\r
61     CompositeNode getData(DataStoreIdentifier store, CompositeNode filter);\r
62 \r
63     /**\r
64      * Returns a candidate data which are not yet commited.\r
65      * \r
66      * \r
67      * @param store\r
68      *            Identifier of the store, from which will be data retrieved\r
69      * @return\r
70      */\r
71     CompositeNode getCandidateData(DataStoreIdentifier store);\r
72 \r
73     /**\r
74      * Returns a filtered subset of candidate data from specified Data Store.\r
75      * \r
76      * <p>\r
77      * The filter is modeled as an hierarchy of {@link Node} starting with\r
78      * {@link CompositeNode} representing data root. The semantics of the filter\r
79      * tree is the same as filter semantics defined in the NETCONF protocol for\r
80      * rpc operations <code>get</code> and <code>get-config</code> in Section 6\r
81      * of RFC6241.\r
82      * \r
83      * \r
84      * @see http://tools.ietf.org/html/rfc6241#section-6\r
85      * @param store\r
86      *            Identifier of the store, from which will be data retrieved\r
87      * @param filter\r
88      *            A CompositeNode filter\r
89      * @return\r
90      */\r
91     CompositeNode getCandidateData(DataStoreIdentifier store,\r
92             CompositeNode filter);\r
93 \r
94     /**\r
95      * \r
96      * @param store\r
97      *            Identifier of the store, in which will be the candidate data\r
98      *            modified\r
99      * @param changeSet\r
100      *            Modification of data tree.\r
101      * @return Result object containing the modified data tree if the operation\r
102      *         was successful, otherwise list of the encountered errors.\r
103      */\r
104     RpcResult<CompositeNode> editCandidateData(DataStoreIdentifier store,\r
105             CompositeNodeModification changeSet);\r
106 \r
107     /**\r
108      * Initiates a two-phase commit of candidate data.\r
109      * \r
110      * <p>\r
111      * The {@link Consumer} could initiate a commit of candidate data\r
112      * \r
113      * <p>\r
114      * The successful commit changes the state of the system and may affect\r
115      * several components.\r
116      * \r
117      * <p>\r
118      * The effects of successful commit of data are described in the\r
119      * specifications and YANG models describing the {@link Provider} components\r
120      * of controller. It is assumed that {@link Consumer} has an understanding\r
121      * of this changes.\r
122      * \r
123      * \r
124      * @see DataCommitHandler for further information how two-phase commit is\r
125      *      processed.\r
126      * @param store\r
127      *            Identifier of the store, where commit should occur.\r
128      * @return Result of the commit, containing success information or list of\r
129      *         encountered errors, if commit was not successful.\r
130      */\r
131     Future<RpcResult<Void>> commit(DataStoreIdentifier store);\r
132 }\r