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