Merge "Bug 499: Added support for old DOM Broker APIs."
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / config / yang / md / sal / dom / impl / DomBrokerImplModule.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.config.yang.md.sal.dom.impl;
9
10 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
11 import org.opendaylight.controller.sal.core.api.data.DataStore;
12 import org.opendaylight.controller.sal.dom.broker.BrokerConfigActivator;
13 import org.opendaylight.controller.sal.dom.broker.BrokerImpl;
14 import org.osgi.framework.BundleContext;
15
16 /**
17 *
18 */
19 public final class DomBrokerImplModule extends org.opendaylight.controller.config.yang.md.sal.dom.impl.AbstractDomBrokerImplModule
20 {
21
22     private BundleContext bundleContext;
23
24     public DomBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
25         super(identifier, dependencyResolver);
26     }
27
28     public DomBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final DomBrokerImplModule oldModule, final java.lang.AutoCloseable oldInstance) {
29         super(identifier, dependencyResolver, oldModule, oldInstance);
30     }
31
32     @Override
33     public void validate(){
34         super.validate();
35     }
36
37     @Override
38     public java.lang.AutoCloseable createInstance() {
39         final BrokerImpl broker = new BrokerImpl();
40         final BrokerConfigActivator activator = new BrokerConfigActivator();
41         final DataStore store = getDataStoreDependency();
42         final DOMDataBroker asyncBroker= getAsyncDataBrokerDependency();
43
44         activator.start(broker, store, asyncBroker,getBundleContext());
45
46 //        final DomBrokerImplRuntimeMXBean domBrokerRuntimeMXBean = new DomBrokerRuntimeMXBeanImpl(activator.getDataService());
47 //        getRootRuntimeBeanRegistratorWrapper().register(domBrokerRuntimeMXBean);
48         return broker;
49     }
50
51     private BundleContext getBundleContext() {
52         return this.bundleContext;
53     }
54
55     public void setBundleContext(final BundleContext bundleContext) {
56         this.bundleContext = bundleContext;
57     }
58 }