Bug 1073: Added Transaction Chain support to Binding transactions.
[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.BindingTransactionChain;
12 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
13 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
14 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
15 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
16 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
17 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
18 import org.opendaylight.controller.sal.core.api.model.SchemaService;
19 import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
20
21 /**
22  * The DataBrokerImpl simply defers to the DOMDataBroker for all its operations.
23  * All transactions and listener registrations are wrapped by the DataBrokerImpl
24  * to allow binding aware components to use the DataBroker transparently.
25  *
26  * Besides this the DataBrokerImpl and it's collaborators also cache data that
27  * is already transformed from the binding independent to binding aware format
28  *
29
30  */
31 public class ForwardedBindingDataBroker extends AbstractForwardedDataBroker implements DataBroker {
32
33     public ForwardedBindingDataBroker(final DOMDataBroker domDataBroker, final BindingIndependentMappingService mappingService, final SchemaService schemaService) {
34         super(domDataBroker, mappingService,schemaService);
35     }
36
37     @Override
38
39     public ReadOnlyTransaction newReadOnlyTransaction() {
40         return new BindingDataReadTransactionImpl(getDelegate().newReadOnlyTransaction(),getCodec());
41     }
42
43     @Override
44     public ReadWriteTransaction newReadWriteTransaction() {
45         return new BindingDataReadWriteTransactionImpl(getDelegate().newReadWriteTransaction(),getCodec());
46     }
47
48     @Override
49     public WriteTransaction newWriteOnlyTransaction() {
50         return new BindingDataWriteTransactionImpl<>(getDelegate().newWriteOnlyTransaction(),getCodec());
51     }
52
53     @Override
54     public BindingTransactionChain createTransactionChain(final TransactionChainListener listener) {
55         return new BindingTranslatedTransactionChain(getDelegate(), getCodec(), listener);
56     }
57 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.