X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fmessagebus-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyang%2Fmessagebus%2Fapp%2Fimpl%2FMessageBusAppImplModule.java;h=9f9d737a64180a29b60e22062826afc84c0d68dd;hb=202de5f104dc8149accab4ebf04c3ec8857edff2;hp=022292a6f37c0f0a7d03802d348b5c88eb83748d;hpb=35128aa4927b06a97e3d1f505a6852105dc81fed;p=controller.git diff --git a/opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/config/yang/messagebus/app/impl/MessageBusAppImplModule.java b/opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/config/yang/messagebus/app/impl/MessageBusAppImplModule.java index 022292a6f3..9f9d737a64 100644 --- a/opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/config/yang/messagebus/app/impl/MessageBusAppImplModule.java +++ b/opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/config/yang/messagebus/app/impl/MessageBusAppImplModule.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the @@ -7,25 +7,19 @@ */ package org.opendaylight.controller.config.yang.messagebus.app.impl; -import java.util.List; import org.opendaylight.controller.config.api.DependencyResolver; import org.opendaylight.controller.config.api.ModuleIdentifier; import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.controller.md.sal.binding.api.MountPointService; -import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService; -import org.opendaylight.controller.md.sal.dom.api.DOMNotificationPublishService; import org.opendaylight.controller.messagebus.app.impl.EventSourceTopology; -import org.opendaylight.controller.messagebus.app.impl.NetconfEventSourceManager; +import org.opendaylight.controller.messagebus.app.util.Providers; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; -import org.opendaylight.controller.sal.core.api.Broker.ProviderSession; import org.osgi.framework.BundleContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class MessageBusAppImplModule extends - org.opendaylight.controller.config.yang.messagebus.app.impl.AbstractMessageBusAppImplModule { - private static final Logger LOGGER = LoggerFactory.getLogger(MessageBusAppImplModule.class); +public class MessageBusAppImplModule extends org.opendaylight.controller.config.yang.messagebus.app.impl.AbstractMessageBusAppImplModule { + private static final Logger LOG = LoggerFactory.getLogger(MessageBusAppImplModule.class); private BundleContext bundleContext; @@ -52,37 +46,12 @@ public class MessageBusAppImplModule extends @Override public java.lang.AutoCloseable createInstance() { - final List namespaceMapping = getNamespaceToStream(); - final ProviderContext bindingCtx = getBindingBrokerDependency().registerProvider(new Providers.BindingAware()); - final ProviderSession domCtx = getDomBrokerDependency().registerProvider(new Providers.BindingIndependent()); - final DataBroker dataBroker = bindingCtx.getSALService(DataBroker.class); - final DOMNotificationPublishService domPublish = domCtx.getService(DOMNotificationPublishService.class); - final DOMMountPointService domMount = domCtx.getService(DOMMountPointService.class); - final MountPointService bindingMount = bindingCtx.getSALService(MountPointService.class); final RpcProviderRegistry rpcRegistry = bindingCtx.getSALService(RpcProviderRegistry.class); - final EventSourceTopology eventSourceTopology = new EventSourceTopology(dataBroker, rpcRegistry); - final NetconfEventSourceManager eventSourceManager = new NetconfEventSourceManager(dataBroker, domPublish, - domMount, bindingMount, eventSourceTopology, getNamespaceToStream()); - - final AutoCloseable closer = new AutoCloseable() { - @Override - public void close() { - eventSourceTopology.close(); - eventSourceManager.close(); - } - }; - - return closer; + LOG.info("Messagebus initialized"); + return eventSourceTopology; } - private void closeProvider(final AutoCloseable closable) { - try { - closable.close(); - } catch (final Exception e) { - LOGGER.error("Exception while closing: {}\n Exception: {}", closable, e); - } - } }