2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.config.yang.md.sal.dom.impl;
10 import org.opendaylight.controller.config.yang.md.sal.dom.statistics.DomBrokerRuntimeMXBeanImpl;
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;
16 import static com.google.common.base.Preconditions.*;
21 public final class DomBrokerImplModule extends org.opendaylight.controller.config.yang.md.sal.dom.impl.AbstractDomBrokerImplModule
24 private BundleContext bundleContext;
26 public DomBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
27 super(identifier, dependencyResolver);
30 public DomBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, DomBrokerImplModule oldModule, java.lang.AutoCloseable oldInstance) {
31 super(identifier, dependencyResolver, oldModule, oldInstance);
35 public void validate(){
37 checkArgument(getDataStore() != null, "Data Store needs to be provided for DomBroker");
41 public java.lang.AutoCloseable createInstance() {
42 final BrokerImpl broker = new BrokerImpl();
43 final BrokerConfigActivator activator = new BrokerConfigActivator();
44 final DataStore store = getDataStoreDependency();
45 activator.start(broker, store, getBundleContext());
47 final DomBrokerImplRuntimeMXBean domBrokerRuntimeMXBean = new DomBrokerRuntimeMXBeanImpl(activator.getDataService());
48 getRootRuntimeBeanRegistratorWrapper().register(domBrokerRuntimeMXBean);
52 private BundleContext getBundleContext() {
53 return this.bundleContext;
56 public void setBundleContext(BundleContext bundleContext) {
57 this.bundleContext = bundleContext;