Bug 629: Make BindingDataBroker to be visible.
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / config / yang / md / sal / binding / impl / BindingBrokerImplModule.java
1 /*\r
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.\r
3  *\r
4  * This program and the accompanying materials are made available under the\r
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7  */\r
8 /**\r
9  * Generated file\r
10 \r
11  * Generated from: yang module name: opendaylight-sal-binding-broker-impl  yang module local name: binding-broker-impl\r
12  * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator\r
13  * Generated at: Wed Nov 20 17:33:01 CET 2013\r
14  *\r
15  * Do not modify this file unless it is present under src/main directory\r
16  */\r
17 package org.opendaylight.controller.config.yang.md.sal.binding.impl;\r
18 \r
19 import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder;\r
20 import org.opendaylight.controller.sal.binding.impl.RootBindingAwareBroker;\r
21 import org.opendaylight.controller.sal.binding.impl.RpcProviderRegistryImpl;\r
22 import org.opendaylight.controller.sal.binding.impl.forward.DomForwardedBindingBrokerImpl;\r
23 import org.opendaylight.controller.sal.binding.impl.forward.DomForwardingUtils;\r
24 import org.osgi.framework.BundleContext;\r
25 \r
26 /**\r
27 *\r
28 */\r
29 public final class BindingBrokerImplModule extends\r
30         org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractBindingBrokerImplModule {\r
31 \r
32     private BundleContext bundleContext;\r
33 \r
34     public BindingBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,\r
35             final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {\r
36         super(identifier, dependencyResolver);\r
37     }\r
38 \r
39     public BindingBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,\r
40             final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,\r
41             final BindingBrokerImplModule oldModule, final java.lang.AutoCloseable oldInstance) {\r
42         super(identifier, dependencyResolver, oldModule, oldInstance);\r
43     }\r
44 \r
45     @Override\r
46     public void validate() {\r
47         super.validate();\r
48     }\r
49 \r
50     @Override\r
51     public java.lang.AutoCloseable createInstance() {\r
52 \r
53         RootBindingAwareBroker broker;\r
54         if (DomForwardingUtils.isDomForwardedBroker(getDataBrokerDependency())) {\r
55             broker = createForwardedBroker();\r
56         } else {\r
57             broker = createStandaloneBroker();\r
58         }\r
59         broker.start();\r
60         return broker;\r
61     }\r
62 \r
63     private RootBindingAwareBroker createStandaloneBroker() {\r
64         RootBindingAwareBroker broker = new RootBindingAwareBroker(getIdentifier().getInstanceName());\r
65 \r
66         broker.setLegacyDataBroker(getDataBrokerDependency());\r
67         broker.setNotificationBroker(getNotificationServiceDependency());\r
68         broker.setRpcBroker(new RpcProviderRegistryImpl(broker.getIdentifier()));\r
69         // FIXME: Also set Async Data Broker\r
70         return broker;\r
71     }\r
72 \r
73     private RootBindingAwareBroker createForwardedBroker() {\r
74         DomForwardedBindingBrokerImpl broker = new DomForwardedBindingBrokerImpl(getIdentifier().getInstanceName());\r
75 \r
76         broker.setLegacyDataBroker(getDataBrokerDependency());\r
77         broker.setNotificationBroker(getNotificationServiceDependency());\r
78         broker.setRpcBroker(new RpcProviderRegistryImpl(broker.getIdentifier()));\r
79 \r
80         broker.getMountManager().setDataCommitExecutor(SingletonHolder.getDefaultCommitExecutor());\r
81         broker.getMountManager().setNotificationExecutor(SingletonHolder.getDefaultNotificationExecutor());\r
82 \r
83         // FIXME: Also set Async Data Broker\r
84         DomForwardingUtils.reuseForwardingFrom(broker, broker.getDataBroker());\r
85         broker.startForwarding();\r
86         return broker;\r
87     }\r
88 \r
89     public BundleContext getBundleContext() {\r
90         return bundleContext;\r
91     }\r
92 \r
93     public void setBundleContext(final BundleContext bundleContext) {\r
94         this.bundleContext = bundleContext;\r
95     }\r
96 }\r

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