Refactor DOMYangTextSourceProvider
[mdsal.git] / dom / mdsal-dom-api / src / main / java / org / opendaylight / mdsal / dom / api / DOMNotificationPublishDemandExtension.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.mdsal.dom.api;
9
10 import com.google.common.annotations.Beta;
11 import com.google.common.collect.ImmutableSet;
12 import org.eclipse.jdt.annotation.NonNullByDefault;
13 import org.opendaylight.yangtools.concepts.Registration;
14 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
15
16 /**
17  * A {@link DOMNotificationPublishService.Extension} providing a view into which {@link DOMNotification}s the extended
18  * {@link DOMNotificationPublishService} is interested in receiving. This is typically driven by listener registrations
19  * in the {@link DOMNotificationService} consuming published notifications.
20  */
21 @Beta
22 @NonNullByDefault
23 public interface DOMNotificationPublishDemandExtension extends DOMNotificationPublishService.Extension {
24     /**
25      * Register a new {@link DemandListener}.
26      *
27      * @param listener the listener to register
28      * @return A {@link Registration}
29      * @throws NullPointerException if {@code listener} is {@code null}
30      */
31     Registration registerDemandListener(DemandListener listener);
32
33     /**
34      * Listener for changes in demand for {@link DOMNotification} types. Changes are communnicated via
35      * {@link #onDemandUpdated(ImmutableSet)}, which reports the delta between last reported and current state.
36      */
37     interface DemandListener {
38         /**
39          * Update the view of what {@link DOMNotification}s are in demand.
40          *
41          * @param neededTypes currently-needed notification types
42          */
43         void onDemandUpdated(ImmutableSet<Absolute> neededTypes);
44     }
45 }