2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.sal.binding.api.data;
10 import java.util.concurrent.Future;
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.concepts.ListenerRegistration;
18 import org.opendaylight.yangtools.yang.binding.DataObject;
19 import org.opendaylight.yangtools.yang.binding.DataRoot;
20 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
21 import org.opendaylight.yangtools.yang.common.RpcResult;
24 * DataBrokerService provides unified access to the data stores available in the
28 * @see DataProviderService
30 public interface DataBrokerService extends //
31 BindingAwareService, //
32 DataModificationTransactionFactory<InstanceIdentifier<? extends DataObject>, DataObject>, //
33 DataReader<InstanceIdentifier<? extends DataObject>, DataObject>, //
34 DataChangePublisher<InstanceIdentifier<? extends DataObject>, DataObject, DataChangeListener> {
37 * Returns a data from specified Data Store.
39 * Returns all the data visible to the consumer from specified Data Store.
42 * Interface generated from YANG module representing root of data
44 * Identifier of the store, from which will be data retrieved
45 * @return data visible to the consumer
48 <T extends DataRoot> T getData(DataStoreIdentifier store, Class<T> rootType);
51 * Returns a filtered subset of data from specified Data Store.
54 * The filter is modeled as an hierarchy of Java TOs starting with
55 * implementation of {@link DataRoot} representing data root. The semantics
56 * of the filter tree is the same as filter semantics defined in the NETCONF
57 * protocol for rpc operations <code>get</code> and <code>get-config</code>
58 * in Section 6 of RFC6241.
61 * @see http://tools.ietf.org/html/rfc6241#section-6
63 * Interface generated from YANG module representing root of data
65 * Identifier of the store, from which will be data retrieved
67 * Data tree filter similar to the NETCONF filter
71 <T extends DataRoot> T getData(DataStoreIdentifier store, T filter);
74 * Returns a candidate data which are not yet commited.
78 * Interface generated from YANG module representing root of data
80 * Identifier of the store, from which will be data retrieved
84 <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, Class<T> rootType);
87 * Returns a filtered subset of candidate data from specified Data Store.
90 * The filter is modeled as an hierarchy of {@link Node} starting with
91 * {@link CompositeNode} representing data root. The semantics of the filter
92 * tree is the same as filter semantics defined in the NETCONF protocol for
93 * rpc operations <code>get</code> and <code>get-config</code> in Section 6
97 * @see http://tools.ietf.org/html/rfc6241#section-6
99 * Interface generated from YANG module representing root of data
101 * Identifier of the store, from which will be data retrieved
107 <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, T filter);
112 * Interface generated from YANG module representing root of data
114 * Identifier of the store, in which will be the candidate data
117 * Modification of data tree.
118 * @return Result object containing the modified data tree if the operation
119 * was successful, otherwise list of the encountered errors.
122 RpcResult<DataRoot> editCandidateData(DataStoreIdentifier store, DataRoot changeSet);
125 * Initiates a two-phase commit of candidate data.
128 * The {@link Consumer} could initiate a commit of candidate data
131 * The successful commit changes the state of the system and may affect
132 * several components.
135 * The effects of successful commit of data are described in the
136 * specifications and YANG models describing the {@link Provider} components
137 * of controller. It is assumed that {@link Consumer} has an understanding
141 * @see DataCommitHandler for further information how two-phase commit is
144 * Identifier of the store, where commit should occur.
145 * @return Result of the commit, containing success information or list of
146 * encountered errors, if commit was not successful.
149 Future<RpcResult<Void>> commit(DataStoreIdentifier store);
152 DataObject getData(InstanceIdentifier<? extends DataObject> data);
155 DataObject getConfigurationData(InstanceIdentifier<?> data);
157 * Creates a data modification transaction.
159 * @return new blank data modification transaction.
161 DataModificationTransaction beginTransaction();
164 public void registerChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener changeListener);
167 public void unregisterChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener changeListener);
170 * Reads data subtree from configurational store.
171 * (Store which is populated by consumer, which is usually used to
172 * inject state into providers. E.g. Flow configuration)-
176 public DataObject readConfigurationData(InstanceIdentifier<? extends DataObject> path);
179 * Reads data subtree from operational store.
180 * (Store which is populated by providers, which is usually used to
181 * capture state of providers. E.g. Topology)
185 public DataObject readOperationalData(InstanceIdentifier<? extends DataObject> path);
188 * Register a data change listener for particular subtree.
190 * Callback is invoked each time data in subtree changes.
194 public ListenerRegistration<DataChangeListener> registerDataChangeListener(
195 InstanceIdentifier<? extends DataObject> path, DataChangeListener listener);