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

©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.