27bbdfd179b6c5ae1d609659b22d6d6c208eb4b3
[netconf.git] / netconf / netconf-notifications-api / src / main / java / org / opendaylight / netconf / notifications / NetconfNotificationCollector.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
9 package org.opendaylight.netconf.notifications;
10
11 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.StreamNameType;
12 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.Stream;
13
14 /**
15  * Collector of all notifications. Base or generic
16  */
17 public interface NetconfNotificationCollector {
18
19     /**
20      * Add notification publisher for a particular stream.
21      *
22      * <p>
23      * Implementations should allow for multiple publishers of a single stream
24      * and its up to implementations to decide how to merge metadata (e.g. description)
25      * for the same stream when providing information about available stream
26      *
27      */
28     NotificationPublisherRegistration registerNotificationPublisher(Stream stream);
29
30     /**
31      * Register base notification publisher.
32      */
33     BaseNotificationPublisherRegistration registerBaseNotificationPublisher();
34
35     /**
36      * Register yang-library publisher.
37      */
38     YangLibraryPublisherRegistration registerYangLibraryPublisher();
39
40     /**
41      * Users of the registry have an option to get notification each time new notification stream gets registered
42      * This allows for a push model in addition to pull model for retrieving information about available streams.
43      *
44      * <p>
45      * The listener should receive callbacks for each stream available prior to the registration when its registered
46      */
47     NotificationRegistration registerStreamListener(NetconfNotificationStreamListener listener);
48
49     /**
50      * Simple listener that receives notifications about changes in stream availability.
51      */
52     public interface NetconfNotificationStreamListener {
53
54         /**
55          * Stream becomes available in the collector (first publisher is registered).
56          */
57         void onStreamRegistered(Stream stream);
58
59         /**
60          * Stream is not available anymore in the collector (last publisher is unregistered).
61          */
62         void onStreamUnregistered(StreamNameType stream);
63     }
64
65 }