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.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;
23 * DataBrokerService provides unified access to the data stores available in the
27 * @see DataProviderService
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> {
36 * Returns a data from specified Data Store.
38 * Returns all the data visible to the consumer from specified Data Store.
41 * Interface generated from YANG module representing root of data
43 * Identifier of the store, from which will be data retrieved
44 * @return data visible to the consumer
47 <T extends DataRoot> T getData(DataStoreIdentifier store, Class<T> rootType);
50 * Returns a filtered subset of data from specified Data Store.
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.
60 * @see http://tools.ietf.org/html/rfc6241#section-6
62 * Interface generated from YANG module representing root of data
64 * Identifier of the store, from which will be data retrieved
66 * Data tree filter similar to the NETCONF filter
70 <T extends DataRoot> T getData(DataStoreIdentifier store, T filter);
73 * Returns a candidate data which are not yet commited.
77 * Interface generated from YANG module representing root of data
79 * Identifier of the store, from which will be data retrieved
83 <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, Class<T> rootType);
86 * Returns a filtered subset of candidate data from specified Data Store.
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
96 * @see http://tools.ietf.org/html/rfc6241#section-6
98 * Interface generated from YANG module representing root of data
100 * Identifier of the store, from which will be data retrieved
106 <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, T filter);
111 * Interface generated from YANG module representing root of data
113 * Identifier of the store, in which will be the candidate data
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.
121 RpcResult<DataRoot> editCandidateData(DataStoreIdentifier store, DataRoot changeSet);
124 * Initiates a two-phase commit of candidate data.
127 * The {@link Consumer} could initiate a commit of candidate data
130 * The successful commit changes the state of the system and may affect
131 * several components.
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
140 * @see DataCommitHandler for further information how two-phase commit is
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.
148 Future<RpcResult<Void>> commit(DataStoreIdentifier store);
151 DataObject getData(InstanceIdentifier<? extends DataObject> data);
154 DataObject getConfigurationData(InstanceIdentifier<?> data);
156 * Creates a data modification transaction.
158 * @return new blank data modification transaction.
160 DataModificationTransaction beginTransaction();
163 public void registerChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener changeListener);
166 public void unregisterChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener changeListener);