Merge "Add support for multiple choice case statements within one augument in config...
[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(org.opendaylight.controller.config.api.ModuleIdentifier identifier,\r
35             org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {\r
36         super(identifier, dependencyResolver);\r
37     }\r
38 \r
39     public BindingBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,\r
40             org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,\r
41             BindingBrokerImplModule oldModule, 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.setDataBroker(getDataBrokerDependency());\r
67         broker.setNotificationBroker(getNotificationServiceDependency());\r
68         broker.setRpcBroker(new RpcProviderRegistryImpl(broker.getIdentifier()));\r
69         return broker;\r
70     }\r
71 \r
72     private RootBindingAwareBroker createForwardedBroker() {\r
73         DomForwardedBindingBrokerImpl broker = new DomForwardedBindingBrokerImpl(getIdentifier().getInstanceName());\r
74 \r
75         broker.setDataBroker(getDataBrokerDependency());\r
76         broker.setNotificationBroker(getNotificationServiceDependency());\r
77         broker.setRpcBroker(new RpcProviderRegistryImpl(broker.getIdentifier()));\r
78 \r
79         broker.getMountManager().setDataCommitExecutor(SingletonHolder.getDefaultCommitExecutor());\r
80         broker.getMountManager().setNotificationExecutor(SingletonHolder.getDefaultNotificationExecutor());\r
81 \r
82 \r
83         DomForwardingUtils.reuseForwardingFrom(broker, broker.getDataBroker());\r
84         broker.startForwarding();\r
85         return broker;\r
86     }\r
87 \r
88     public BundleContext getBundleContext() {\r
89         return bundleContext;\r
90     }\r
91 \r
92     public void setBundleContext(BundleContext bundleContext) {\r
93         this.bundleContext = bundleContext;\r
94     }\r
95 }\r