Deprecate old MD-SAL APIs for removal
[controller.git] / opendaylight / md-sal / sal-binding-api / src / main / java / org / opendaylight / controller / sal / binding / api / NotificationProviderService.java
1 /*
2  * Copyright (c) 2013 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.sal.binding.api;
9
10 import java.util.EventListener;
11 import java.util.concurrent.ExecutorService;
12 import org.opendaylight.controller.md.sal.common.api.notify.NotificationPublishService;
13 import org.opendaylight.yangtools.concepts.ListenerRegistration;
14 import org.opendaylight.yangtools.yang.binding.Notification;
15
16 /**
17  * Interface for a notification service that provides publish/subscribe capabilities for YANG
18  * modeled notifications. This interface is a combination of the {@link NotificationService} and
19  * {@link NotificationPublishService} interfaces.
20  *
21  * @deprecated Please use {@link org.opendaylight.mdsal.binding.api.NotificationPublishService}.
22  */
23 @Deprecated(forRemoval = true)
24 public interface NotificationProviderService extends NotificationService, NotificationPublishService<Notification> {
25
26     @Override
27     void publish(Notification notification);
28
29     @Override
30     void publish(Notification notification, ExecutorService executor);
31
32     /**
33      * Registers a listener to be notified about notification subscriptions. This
34      * enables a component to know when there is a notification listener subscribed
35      * for a particular notification type.
36      *
37      * <p>
38      * On registration of this listener, the
39      * {@link NotificationInterestListener#onNotificationSubscribtion(Class)} method
40      * will be invoked for every notification type that currently has a notification listener
41      * subscribed.
42      *
43      * @param interestListener the listener that will be notified when subscriptions
44      *                         for new notification types occur.
45      * @return a {@link ListenerRegistration} instance that should be used to unregister the listener
46      *         by invoking the {@link ListenerRegistration#close()} method when no longer needed.
47      */
48     ListenerRegistration<NotificationInterestListener> registerInterestListener(
49             NotificationInterestListener interestListener);
50
51     /**
52      * Interface for a listener interested in being notified about notification subscriptions.
53      */
54     interface NotificationInterestListener extends EventListener {
55
56         /**
57          * Callback that is invoked when a notification listener subscribes for a particular notification type.
58          *
59          * <p>
60          * This method is only called for the first subscription that occurs for a
61          * particular notification type. Subsequent subscriptions for the same
62          * notification type do not trigger invocation of this method.
63          *
64          * <p>
65          * <b>Note:</b>This callback is delivered from thread not owned by this listener,
66          * all processing should be as fast as possible and implementations should
67          * not do any blocking calls or block this thread.
68          *
69          * @param notificationType the notification type for the subscription that occurred.
70          */
71         void onNotificationSubscribtion(Class<? extends Notification> notificationType);
72     }
73 }

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