Replaced Helium Notification Broker with new Notifcation Broker.
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / config / yang / md / sal / binding / impl / NotificationBrokerImplModule.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.config.yang.md.sal.binding.impl;
9
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.sal.binding.codegen.impl.SingletonHolder;
14 import org.opendaylight.controller.sal.binding.impl.NotificationBrokerImpl;
15
16 /**
17 *
18 */
19 public final class NotificationBrokerImplModule extends
20         org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractNotificationBrokerImplModule {
21
22     public NotificationBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
23             final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
24         super(identifier, dependencyResolver);
25     }
26
27     public NotificationBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
28             final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
29             final NotificationBrokerImplModule oldModule, final java.lang.AutoCloseable oldInstance) {
30         super(identifier, dependencyResolver, oldModule, oldInstance);
31     }
32
33     @Override
34     public void validate() {
35         super.validate();
36         // Add custom validation for module attributes here.
37     }
38
39     @Override
40     public java.lang.AutoCloseable createInstance() {
41
42         final NotificationPublishService notificationPublishService = getNotificationPublishAdapterDependency();
43         final NotificationService notificationService = getNotificationAdapterDependency();
44
45         if(notificationPublishService != null & notificationService != null) {
46             return new HeliumNotificationProviderServiceAdapter(notificationPublishService, notificationService);
47         }
48
49         /*
50          *  FIXME: Switch to new broker (which has different threading model)
51          *  once this change is communicated with downstream users or
52          *  we will have adapter implementation which will honor Helium
53          *  threading model for notifications.
54          */
55
56         return new NotificationBrokerImpl(SingletonHolder.getDefaultNotificationExecutor());
57     }
58 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.