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.binding.impl;
10 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
11 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
12 import org.opendaylight.controller.md.sal.binding.compat.HeliumNotificationProviderServiceAdapter;
13 import org.opendaylight.controller.md.sal.binding.compat.HeliumNotificationProviderServiceWithInterestListeners;
14 import org.opendaylight.controller.md.sal.binding.impl.BindingDOMNotificationPublishServiceAdapter;
15 import org.opendaylight.controller.md.sal.binding.impl.BindingDOMNotificationServiceAdapter;
16 import org.opendaylight.controller.md.sal.dom.api.DOMNotificationPublishService;
17 import org.opendaylight.controller.md.sal.dom.spi.DOMNotificationSubscriptionListenerRegistry;
20 * @deprecated Replaced by blueprint wiring
23 public final class NotificationBrokerImplModule extends
24 org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractNotificationBrokerImplModule {
26 public NotificationBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
27 final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
28 super(identifier, dependencyResolver);
31 public NotificationBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
32 final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
33 final NotificationBrokerImplModule oldModule, final java.lang.AutoCloseable oldInstance) {
34 super(identifier, dependencyResolver, oldModule, oldInstance);
38 public void validate() {
40 // Add custom validation for module attributes here.
44 public java.lang.AutoCloseable createInstance() {
45 return createHeliumAdapter(getNotificationPublishAdapterDependency(), getNotificationAdapterDependency());
48 private static AutoCloseable createHeliumAdapter(final NotificationPublishService publishService,
49 final NotificationService listenService) {
50 if (listenService instanceof BindingDOMNotificationServiceAdapter
51 && publishService instanceof BindingDOMNotificationPublishServiceAdapter) {
52 final BindingDOMNotificationPublishServiceAdapter castedPublish =
53 (BindingDOMNotificationPublishServiceAdapter) publishService;
54 final BindingDOMNotificationServiceAdapter castedListen =
55 (BindingDOMNotificationServiceAdapter) listenService;
56 final DOMNotificationPublishService domPublishService = castedPublish.getDomPublishService();
57 if (domPublishService instanceof DOMNotificationSubscriptionListenerRegistry) {
58 final DOMNotificationSubscriptionListenerRegistry subsRegistry =
59 (DOMNotificationSubscriptionListenerRegistry) domPublishService;
60 return new HeliumNotificationProviderServiceWithInterestListeners(castedPublish, castedListen,
64 return new HeliumNotificationProviderServiceAdapter(publishService, listenService);