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.sal.binding.api.BindingAwareService;
13 import org.opendaylight.controller.sal.common.DataStoreIdentifier;
14 import org.opendaylight.yangtools.yang.binding.DataRoot;
15 import org.opendaylight.yangtools.yang.common.RpcResult;
18 * DataBrokerService provides unified access to the data stores available in the
22 * @see DataProviderService
24 public interface DataBrokerService extends BindingAwareService {
27 * Returns a data from specified Data Store.
29 * Returns all the data visible to the consumer from specified Data Store.
32 * Interface generated from YANG module representing root of data
34 * Identifier of the store, from which will be data retrieved
35 * @return data visible to the consumer
37 <T extends DataRoot> T getData(DataStoreIdentifier store, Class<T> rootType);
40 * Returns a filtered subset of data from specified Data Store.
43 * The filter is modeled as an hierarchy of Java TOs starting with
44 * implementation of {@link DataRoot} representing data root. The semantics
45 * of the filter tree is the same as filter semantics defined in the NETCONF
46 * protocol for rpc operations <code>get</code> and <code>get-config</code>
47 * in Section 6 of RFC6241.
50 * @see http://tools.ietf.org/html/rfc6241#section-6
52 * Interface generated from YANG module representing root of data
54 * Identifier of the store, from which will be data retrieved
56 * Data tree filter similar to the NETCONF filter
59 <T extends DataRoot> T getData(DataStoreIdentifier store, T filter);
62 * Returns a candidate data which are not yet commited.
66 * Interface generated from YANG module representing root of data
68 * Identifier of the store, from which will be data retrieved
71 <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, Class<T> rootType);
74 * Returns a filtered subset of candidate data from specified Data Store.
77 * The filter is modeled as an hierarchy of {@link Node} starting with
78 * {@link CompositeNode} representing data root. The semantics of the filter
79 * tree is the same as filter semantics defined in the NETCONF protocol for
80 * rpc operations <code>get</code> and <code>get-config</code> in Section 6
84 * @see http://tools.ietf.org/html/rfc6241#section-6
86 * Interface generated from YANG module representing root of data
88 * Identifier of the store, from which will be data retrieved
93 <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, T filter);
98 * Interface generated from YANG module representing root of data
100 * Identifier of the store, in which will be the candidate data
103 * Modification of data tree.
104 * @return Result object containing the modified data tree if the operation
105 * was successful, otherwise list of the encountered errors.
107 RpcResult<DataRoot> editCandidateData(DataStoreIdentifier store, DataRoot changeSet);
110 * Initiates a two-phase commit of candidate data.
113 * The {@link Consumer} could initiate a commit of candidate data
116 * The successful commit changes the state of the system and may affect
117 * several components.
120 * The effects of successful commit of data are described in the
121 * specifications and YANG models describing the {@link Provider} components
122 * of controller. It is assumed that {@link Consumer} has an understanding
126 * @see DataCommitHandler for further information how two-phase commit is
129 * Identifier of the store, where commit should occur.
130 * @return Result of the commit, containing success information or list of
131 * encountered errors, if commit was not successful.
133 Future<RpcResult<Void>> commit(DataStoreIdentifier store);