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