Bug 1073: Extracted Implementation of Binding Transaction
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / md / sal / binding / impl / ForwardedBindingDataBroker.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.md.sal.binding.impl;
9
10
11 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
12 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
13 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
14 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
15 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
16 import org.opendaylight.controller.sal.core.api.model.SchemaService;
17 import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
18
19 /**
20  * The DataBrokerImpl simply defers to the DOMDataBroker for all its operations.
21  * All transactions and listener registrations are wrapped by the DataBrokerImpl
22  * to allow binding aware components to use the DataBroker transparently.
23  *
24  * Besides this the DataBrokerImpl and it's collaborators also cache data that
25  * is already transformed from the binding independent to binding aware format
26  *
27
28  */
29 public class ForwardedBindingDataBroker extends AbstractForwardedDataBroker implements DataBroker {
30
31     public ForwardedBindingDataBroker(final DOMDataBroker domDataBroker, final BindingIndependentMappingService mappingService, final SchemaService schemaService) {
32         super(domDataBroker, mappingService,schemaService);
33     }
34
35     @Override
36
37     public ReadOnlyTransaction newReadOnlyTransaction() {
38         return new BindingDataReadTransactionImpl(getDelegate().newReadOnlyTransaction(),getCodec());
39     }
40
41     @Override
42     public ReadWriteTransaction newReadWriteTransaction() {
43         return new BindingDataReadWriteTransactionImpl(getDelegate().newReadWriteTransaction(),getCodec());
44     }
45
46     @Override
47     public WriteTransaction newWriteOnlyTransaction() {
48         return new BindingDataWriteTransactionImpl<>(getDelegate().newWriteOnlyTransaction(),getCodec());
49     }
50 }