149c2c2dab04f72241326d3472ac43876f31fc7e
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / md / sal / binding / compat / HeliumNotificationProviderServiceAdapter.java
1 /*
2  * Copyright (c) 2015 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.md.sal.binding.compat;
9
10 import java.util.concurrent.ExecutorService;
11 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
12 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
13 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
14 import org.opendaylight.yangtools.concepts.ListenerRegistration;
15 import org.opendaylight.yangtools.yang.binding.Notification;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18
19 public class HeliumNotificationProviderServiceAdapter extends HeliumNotificationServiceAdapter
20         implements NotificationProviderService {
21     private static final Logger LOG = LoggerFactory.getLogger(HeliumNotificationProviderServiceAdapter.class);
22
23     private final NotificationPublishService notificationPublishService;
24
25     public HeliumNotificationProviderServiceAdapter(NotificationPublishService notificationPublishService,
26                                                  NotificationService notificationService) {
27         super(notificationService);
28         this.notificationPublishService = notificationPublishService;
29     }
30
31     @Override
32     public void publish(final Notification notification) {
33         try {
34             notificationPublishService.putNotification(notification);
35         } catch (InterruptedException e) {
36             LOG.error("Notification publication was interupted: "  + e);
37         }
38     }
39
40     @Override
41     public void publish(final Notification notification, final ExecutorService executor) {
42         try {
43             notificationPublishService.putNotification(notification);
44         } catch (InterruptedException e) {
45             LOG.error("Notification publication was interupted: "  + e);
46         }
47     }
48
49     @Override
50     public ListenerRegistration<NotificationInterestListener> registerInterestListener(
51             NotificationInterestListener interestListener) {
52         throw new UnsupportedOperationException("InterestListener is not supported.");
53     }
54
55     @Override
56     public void close() throws Exception {
57     }
58 }