ef66d80ed445b1e323dc5c2ad770236e42eb64a8
[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
20 /**
21  * The DataBrokerImpl simply defers to the DOMDataBroker for all its operations.
22  * All transactions and listener registrations are wrapped by the DataBrokerImpl
23  * to allow binding aware components to use the DataBroker transparently.
24  *
25  * Besides this the DataBrokerImpl and it's collaborators also cache data that
26  * is already transformed from the binding independent to binding aware format
27  *
28
29  */
30 public class ForwardedBindingDataBroker extends AbstractForwardedDataBroker implements DataBroker {
31
32     public ForwardedBindingDataBroker(final DOMDataBroker domDataBroker, final BindingToNormalizedNodeCodec codec, final SchemaService schemaService) {
33         super(domDataBroker, codec,schemaService);
34     }
35
36     @Override
37
38     public ReadOnlyTransaction newReadOnlyTransaction() {
39         return new BindingDataReadTransactionImpl(getDelegate().newReadOnlyTransaction(),getCodec());
40     }
41
42     @Override
43     public ReadWriteTransaction newReadWriteTransaction() {
44         return new BindingDataReadWriteTransactionImpl(getDelegate().newReadWriteTransaction(),getCodec());
45     }
46
47     @Override
48     public WriteTransaction newWriteOnlyTransaction() {
49         return new BindingDataWriteTransactionImpl<>(getDelegate().newWriteOnlyTransaction(),getCodec());
50     }
51
52     @Override
53     public BindingTransactionChain createTransactionChain(final TransactionChainListener listener) {
54         return new BindingTranslatedTransactionChain(getDelegate(), getCodec(), listener);
55     }
56 }

©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.