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;
22 * @deprecated Replaced by blueprint wiring
25 public final class NotificationBrokerImplModule extends
26 org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractNotificationBrokerImplModule {
28 public NotificationBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
29 final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
30 super(identifier, dependencyResolver);
33 public NotificationBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
34 final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
35 final NotificationBrokerImplModule oldModule, final java.lang.AutoCloseable oldInstance) {
36 super(identifier, dependencyResolver, oldModule, oldInstance);
40 public void validate() {
42 // Add custom validation for module attributes here.
46 public java.lang.AutoCloseable createInstance() {
47 return createHeliumAdapter(getNotificationPublishAdapterDependency(), getNotificationAdapterDependency());
50 private static AutoCloseable createHeliumAdapter(final NotificationPublishService publishService,
51 final NotificationService listenService) {
52 if (listenService instanceof BindingDOMNotificationServiceAdapter
53 && publishService instanceof BindingDOMNotificationPublishServiceAdapter) {
54 final BindingDOMNotificationPublishServiceAdapter castedPublish =
55 (BindingDOMNotificationPublishServiceAdapter) publishService;
56 final BindingDOMNotificationServiceAdapter castedListen =
57 (BindingDOMNotificationServiceAdapter) listenService;
58 final DOMNotificationPublishService domPublishService = castedPublish.getDomPublishService();
59 if (domPublishService instanceof DOMNotificationSubscriptionListenerRegistry) {
60 final DOMNotificationSubscriptionListenerRegistry subsRegistry =
61 (DOMNotificationSubscriptionListenerRegistry) domPublishService;
62 return new HeliumNotificationProviderServiceWithInterestListeners(castedPublish, castedListen,
66 return new HeliumNotificationProviderServiceAdapter(publishService, listenService);