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