2 * Copyright (c) 2015 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.messagebus.app.impl;
10 import org.opendaylight.controller.config.api.DependencyResolver;
11 import org.opendaylight.controller.config.api.ModuleIdentifier;
12 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
13 import org.opendaylight.controller.messagebus.app.impl.EventSourceTopology;
14 import org.opendaylight.controller.messagebus.app.util.Providers;
15 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
16 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
17 import org.osgi.framework.BundleContext;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
21 public class MessageBusAppImplModule extends org.opendaylight.controller.config.yang.messagebus.app.impl.AbstractMessageBusAppImplModule {
22 private static final Logger LOG = LoggerFactory.getLogger(MessageBusAppImplModule.class);
24 private BundleContext bundleContext;
26 public BundleContext getBundleContext() {
30 public void setBundleContext(final BundleContext bundleContext) {
31 this.bundleContext = bundleContext;
34 public MessageBusAppImplModule(final ModuleIdentifier identifier, final DependencyResolver dependencyResolver) {
35 super(identifier, dependencyResolver);
38 public MessageBusAppImplModule(final ModuleIdentifier identifier, final DependencyResolver dependencyResolver,
39 final MessageBusAppImplModule oldModule, final java.lang.AutoCloseable oldInstance) {
40 super(identifier, dependencyResolver, oldModule, oldInstance);
44 protected void customValidation() {
48 public java.lang.AutoCloseable createInstance() {
49 final ProviderContext bindingCtx = getBindingBrokerDependency().registerProvider(new Providers.BindingAware());
50 final DataBroker dataBroker = bindingCtx.getSALService(DataBroker.class);
51 final RpcProviderRegistry rpcRegistry = bindingCtx.getSALService(RpcProviderRegistry.class);
52 final EventSourceTopology eventSourceTopology = new EventSourceTopology(dataBroker, rpcRegistry);
53 LOG.info("Messagebus initialized");
54 return eventSourceTopology;