2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.mdsal.dom.api;
10 import java.util.Collection;
11 import java.util.List;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.opendaylight.yangtools.concepts.Registration;
15 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
18 * A {@link DOMService} which allows its users to subscribe to receive top-level (YANG 1.0) {@link DOMNotification}s.
20 public interface DOMNotificationService extends DOMService<DOMNotificationService, DOMNotificationService.Extension> {
22 * Marker interface for an extension to {@link DOMNotificationService}.
24 interface Extension extends DOMService.Extension<DOMNotificationService, Extension> {
29 * Register a {@link DOMNotificationListener} to receive a set of notifications. As with other
30 * {@link Registration}-based interfaces, registering an instance multiple times results in
31 * notifications being delivered for each registration.
33 * @param listener Notification instance to register
34 * @param types Notification types which should be delivered to the listener. Duplicate entries are processed only
35 * once, null entries are ignored.
36 * @return Registration handle. Invoking {@link Registration#close()} will stop the delivery of notifications to the
38 * @throws IllegalArgumentException if types is empty or contains an invalid element, such as {@code null} or a
39 * schema node identifier which does not represent a valid {@link DOMNotification} type.
40 * @throws NullPointerException if either of the arguments is {@code null}
42 @NonNull Registration registerNotificationListener(@NonNull DOMNotificationListener listener,
43 @NonNull Collection<Absolute> types);
46 * Register a {@link DOMNotificationListener} to receive a set of notifications. As with other
47 * {@link Registration}-based interfaces, registering an instance multiple times results in
48 * notifications being delivered for each registration.
50 * @param listener Notification instance to register
51 * @param types Notification types which should be delivered to the listener. Duplicate entries are processed only
52 * once, null entries are ignored.
53 * @return Registration handle. Invoking {@link Registration#close()} will stop the delivery of notifications to the
55 * @throws IllegalArgumentException if types is empty or contains an invalid element, such as {@code null} or a
56 * schema node identifier which does not represent a valid {@link DOMNotification} type.
57 * @throws NullPointerException if listener is {@code null}
59 default @NonNull Registration registerNotificationListener(@NonNull final DOMNotificationListener listener,
60 final Absolute... types) {
61 return registerNotificationListener(listener, List.of(types));
65 * Register a number of {@link DOMNotificationListener}s to receive some notification notifications. As with other
66 * {@link Registration}-based interfaces, registering an instance multiple times results in
67 * notifications being delivered for each registration.
69 * @param typeToListener Specification of which types to listen to with which listeners
70 * @throws NullPointerException if {@code typeToListener} is {@code null}
72 @NonNull Registration registerNotificationListeners(@NonNull Map<Absolute, DOMNotificationListener> typeToListener);