2 * Copyright (c) 2014 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.impl;
\r
11 import java.util.concurrent.Future;
12 import java.util.concurrent.atomic.AtomicLong;
14 import org.opendaylight.controller.md.sal.common.impl.service.AbstractDataBroker;
15 import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
16 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
17 import org.opendaylight.controller.sal.binding.impl.util.BindingAwareDataReaderRouter;
18 import org.opendaylight.controller.sal.common.DataStoreIdentifier;
19 import org.opendaylight.yangtools.yang.binding.DataObject;
20 import org.opendaylight.yangtools.yang.binding.DataRoot;
21 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
22 import org.opendaylight.yangtools.yang.common.RpcResult;
25 public class DataBrokerImpl extends AbstractDataBroker<InstanceIdentifier<? extends DataObject>, DataObject, DataChangeListener> //
\r
26 implements DataProviderService, AutoCloseable {
\r
28 private final AtomicLong nextTransaction = new AtomicLong();
\r
29 private final AtomicLong createdTransactionsCount = new AtomicLong();
\r
31 public AtomicLong getCreatedTransactionsCount() {
\r
32 return createdTransactionsCount;
\r
35 public DataBrokerImpl() {
\r
36 setDataReadRouter(new BindingAwareDataReaderRouter());
\r
40 public DataTransactionImpl beginTransaction() {
\r
41 String transactionId = "BA-" + nextTransaction.getAndIncrement();
\r
42 createdTransactionsCount.getAndIncrement();
\r
43 return new DataTransactionImpl(transactionId,this);
\r
48 public <T extends DataRoot> T getData(DataStoreIdentifier store, Class<T> rootType) {
\r
49 throw new UnsupportedOperationException("Deprecated");
\r
54 public <T extends DataRoot> T getData(DataStoreIdentifier store, T filter) {
\r
55 throw new UnsupportedOperationException("Deprecated");
\r
60 public <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, Class<T> rootType) {
\r
61 throw new UnsupportedOperationException("Deprecated");
\r
66 public <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, T filter) {
\r
67 throw new UnsupportedOperationException("Deprecated");
\r
72 public RpcResult<DataRoot> editCandidateData(DataStoreIdentifier store, DataRoot changeSet) {
\r
73 throw new UnsupportedOperationException("Deprecated");
\r
78 public Future<RpcResult<Void>> commit(DataStoreIdentifier store) {
\r
79 throw new UnsupportedOperationException("Deprecated");
\r
84 public DataObject getData(InstanceIdentifier<? extends DataObject> data) {
\r
85 throw new UnsupportedOperationException("Deprecated");
\r
90 public DataObject getConfigurationData(InstanceIdentifier<?> data) {
\r
91 throw new UnsupportedOperationException("Deprecated");
\r
96 public void registerChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener changeListener) {
\r
97 throw new UnsupportedOperationException("Deprecated");
\r
102 public void unregisterChangeListener(InstanceIdentifier<? extends DataObject> path,
\r
103 DataChangeListener changeListener) {
\r
104 throw new UnsupportedOperationException("Deprecated");
\r
108 public void close() throws Exception {
\r
113 protected boolean isAffectedBy(InstanceIdentifier<? extends DataObject> key,
114 Set<InstanceIdentifier<? extends DataObject>> paths) {
115 if (paths.contains(key)) {
118 for (InstanceIdentifier<?> path : paths) {
119 if (key.containsWildcarded(path)) {