Updated SAL Binding APIs
[controller.git] / opendaylight / md-sal / sal-binding-api / src / main / java / org / opendaylight / controller / sal / binding / 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.binding.api.data;
9
10 import java.util.concurrent.Future;
11
12 import org.opendaylight.controller.sal.binding.api.BindingAwareService;
13 import org.opendaylight.controller.sal.common.DataStoreIdentifier;
14 import org.opendaylight.yangtools.yang.binding.DataObject;
15 import org.opendaylight.yangtools.yang.binding.DataRoot;
16 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
17 import org.opendaylight.yangtools.yang.common.RpcResult;
18
19 /**
20  * DataBrokerService provides unified access to the data stores available in the
21  * system.
22  * 
23  * 
24  * @see DataProviderService
25  */
26 public interface DataBrokerService extends BindingAwareService {
27
28     /**
29      * Returns a data from specified Data Store.
30      * 
31      * Returns all the data visible to the consumer from specified Data Store.
32      * 
33      * @param <T>
34      *            Interface generated from YANG module representing root of data
35      * @param store
36      *            Identifier of the store, from which will be data retrieved
37      * @return data visible to the consumer
38      */
39     <T extends DataRoot> T getData(DataStoreIdentifier store, Class<T> rootType);
40
41     /**
42      * Returns a filtered subset of data from specified Data Store.
43      * 
44      * <p>
45      * The filter is modeled as an hierarchy of Java TOs starting with
46      * implementation of {@link DataRoot} representing data root. The semantics
47      * of the filter tree is the same as filter semantics defined in the NETCONF
48      * protocol for rpc operations <code>get</code> and <code>get-config</code>
49      * in Section 6 of RFC6241.
50      * 
51      * 
52      * @see http://tools.ietf.org/html/rfc6241#section-6
53      * @param <T>
54      *            Interface generated from YANG module representing root of data
55      * @param store
56      *            Identifier of the store, from which will be data retrieved
57      * @param filter
58      *            Data tree filter similar to the NETCONF filter
59      * @return
60      */
61     @Deprecated
62     <T extends DataRoot> T getData(DataStoreIdentifier store, T filter);
63
64     /**
65      * Returns a candidate data which are not yet commited.
66      * 
67      * 
68      * @param <T>
69      *            Interface generated from YANG module representing root of data
70      * @param store
71      *            Identifier of the store, from which will be data retrieved
72      * @return
73      */
74     @Deprecated
75     <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, Class<T> rootType);
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 <T>
90      *            Interface generated from YANG module representing root of data
91      * @param store
92      *            Identifier of the store, from which will be data retrieved
93      * @param filter
94      *            A filter data root
95      * @return
96      */
97     @Deprecated
98     <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, T filter);
99
100     /**
101      * 
102      * @param <T>
103      *            Interface generated from YANG module representing root of data
104      * @param store
105      *            Identifier of the store, in which will be the candidate data
106      *            modified
107      * @param changeSet
108      *            Modification of data tree.
109      * @return Result object containing the modified data tree if the operation
110      *         was successful, otherwise list of the encountered errors.
111      */
112     @Deprecated
113     RpcResult<DataRoot> editCandidateData(DataStoreIdentifier store, DataRoot changeSet);
114
115     /**
116      * Initiates a two-phase commit of candidate data.
117      * 
118      * <p>
119      * The {@link Consumer} could initiate a commit of candidate data
120      * 
121      * <p>
122      * The successful commit changes the state of the system and may affect
123      * several components.
124      * 
125      * <p>
126      * The effects of successful commit of data are described in the
127      * specifications and YANG models describing the {@link Provider} components
128      * of controller. It is assumed that {@link Consumer} has an understanding
129      * of this changes.
130      * 
131      * 
132      * @see DataCommitHandler for further information how two-phase commit is
133      *      processed.
134      * @param store
135      *            Identifier of the store, where commit should occur.
136      * @return Result of the commit, containing success information or list of
137      *         encountered errors, if commit was not successful.
138      */
139     @Deprecated
140     Future<RpcResult<Void>> commit(DataStoreIdentifier store);
141     
142     
143     DataObject getData(InstanceIdentifier data);
144     DataObject getConfigurationData(InstanceIdentifier data);
145     
146     /**
147      * Creates a data modification transaction.
148      * 
149      * @return new blank data modification transaction.
150      */
151     DataModification beginTransaction();
152 }