Eliminate BindingToNormalizedNodeCodecFactory.getOrCreateInstance()
[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 implements NotificationProviderService, AutoCloseable {
20     private static final Logger LOG = LoggerFactory.getLogger(HeliumNotificationProviderServiceAdapter.class);
21
22     private final NotificationPublishService notificationPublishService;
23
24     public HeliumNotificationProviderServiceAdapter(NotificationPublishService notificationPublishService,
25                                                  NotificationService notificationService) {
26         super(notificationService);
27         this.notificationPublishService = notificationPublishService;
28     }
29
30     @Override
31     public void publish(final Notification notification) {
32         try {
33             notificationPublishService.putNotification(notification);
34         } catch (InterruptedException e) {
35             LOG.error("Notification publication was interupted: "  + e);
36         }
37     }
38
39     @Override
40     public void publish(final Notification notification, final ExecutorService executor) {
41         try {
42             notificationPublishService.putNotification(notification);
43         } catch (InterruptedException e) {
44             LOG.error("Notification publication was interupted: "  + e);
45         }
46     }
47
48     @Override
49     public ListenerRegistration<NotificationInterestListener> registerInterestListener(
50             NotificationInterestListener interestListener) {
51         throw new UnsupportedOperationException("InterestListener is not supported.");
52     }
53
54     @Override
55     public void close() throws Exception {
56
57     }
58
59 }