Merge "Fixed invalid value in TestFromSalConversionsUtils."
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / sal / binding / impl / DataBrokerImpl.java
1 package org.opendaylight.controller.sal.binding.impl;\r
2 \r
3 import java.util.concurrent.Future;\r
4 import java.util.concurrent.atomic.AtomicLong;\r
5 \r
6 import org.opendaylight.controller.md.sal.common.impl.service.AbstractDataBroker;\r
7 import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;\r
8 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;\r
9 import org.opendaylight.controller.sal.binding.impl.util.BindingAwareDataReaderRouter;\r
10 import org.opendaylight.controller.sal.common.DataStoreIdentifier;\r
11 import org.opendaylight.yangtools.yang.binding.DataObject;\r
12 import org.opendaylight.yangtools.yang.binding.DataRoot;\r
13 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;\r
14 import org.opendaylight.yangtools.yang.common.RpcResult;\r
15 \r
16 \r
17 public class DataBrokerImpl extends AbstractDataBroker<InstanceIdentifier<? extends DataObject>, DataObject, DataChangeListener> implements\r
18         DataProviderService, AutoCloseable {\r
19 \r
20     private final AtomicLong nextTransaction = new AtomicLong();\r
21     private final AtomicLong createdTransactionsCount = new AtomicLong();\r
22     \r
23     public AtomicLong getCreatedTransactionsCount() {\r
24         return createdTransactionsCount;\r
25     }\r
26 \r
27     public DataBrokerImpl() {\r
28         setDataReadRouter(new BindingAwareDataReaderRouter());\r
29     }\r
30 \r
31     @Override\r
32     public DataTransactionImpl beginTransaction() {\r
33         String transactionId = "BA-" + nextTransaction.getAndIncrement();\r
34         createdTransactionsCount.getAndIncrement();\r
35         return new DataTransactionImpl(transactionId,this);\r
36     }\r
37 \r
38     @Override\r
39     @Deprecated\r
40     public <T extends DataRoot> T getData(DataStoreIdentifier store, Class<T> rootType) {\r
41         throw new UnsupportedOperationException("Deprecated");\r
42     }\r
43 \r
44     @Override\r
45     @Deprecated\r
46     public <T extends DataRoot> T getData(DataStoreIdentifier store, T filter) {\r
47         throw new UnsupportedOperationException("Deprecated");\r
48     }\r
49 \r
50     @Override\r
51     @Deprecated\r
52     public <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, Class<T> rootType) {\r
53         throw new UnsupportedOperationException("Deprecated");\r
54     }\r
55 \r
56     @Override\r
57     @Deprecated\r
58     public <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, T filter) {\r
59         throw new UnsupportedOperationException("Deprecated");\r
60     }\r
61 \r
62     @Override\r
63     @Deprecated\r
64     public RpcResult<DataRoot> editCandidateData(DataStoreIdentifier store, DataRoot changeSet) {\r
65         throw new UnsupportedOperationException("Deprecated");\r
66     }\r
67 \r
68     @Override\r
69     @Deprecated\r
70     public Future<RpcResult<Void>> commit(DataStoreIdentifier store) {\r
71         throw new UnsupportedOperationException("Deprecated");\r
72     }\r
73 \r
74     @Override\r
75     @Deprecated\r
76     public DataObject getData(InstanceIdentifier<? extends DataObject> data) {\r
77         throw new UnsupportedOperationException("Deprecated");\r
78     }\r
79 \r
80     @Override\r
81     @Deprecated\r
82     public DataObject getConfigurationData(InstanceIdentifier<?> data) {\r
83         throw new UnsupportedOperationException("Deprecated");\r
84     }\r
85 \r
86     @Override\r
87     @Deprecated\r
88     public void registerChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener changeListener) {\r
89         throw new UnsupportedOperationException("Deprecated");\r
90     }\r
91 \r
92     @Override\r
93     @Deprecated\r
94     public void unregisterChangeListener(InstanceIdentifier<? extends DataObject> path,\r
95             DataChangeListener changeListener) {\r
96         throw new UnsupportedOperationException("Deprecated");\r
97     }\r
98     \r
99     @Override\r
100     public void close() throws Exception {\r
101         \r
102     }\r
103 }