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.controller.md.sal.dom.api;
10 import java.util.Collection;
11 import javax.annotation.Nonnull;
12 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
15 * A {@link DOMService} which allows its users to subscribe to receive
16 * {@link DOMNotification}s.
18 public interface DOMNotificationService {
20 * Register a {@link DOMNotificationListener} to receive a set of notifications. As with
21 * other ListenerRegistration-based interfaces, registering an instance multiple times
22 * results in notifications being delivered for each registration.
24 * @param listener Notification instance to register
25 * @param types Notification types which should be delivered to the listener. Duplicate
26 * entries are processed only once, null entries are ignored.
27 * @return Registration handle. Invoking {@link DOMNotificationListenerRegistration#close()}
28 * will stop the delivery of notifications to the listener
29 * @throws IllegalArgumentException if types is empty or contains an invalid element, such as
30 * null or a SchemaPath which does not represent a valid {@link DOMNotification} type.
31 * @throws NullPointerException if either of the arguments is null
33 DOMNotificationListenerRegistration registerNotificationListener(@Nonnull DOMNotificationListener listener, @Nonnull Collection<SchemaPath> types);
36 * Register a {@link DOMNotificationListener} to receive a set of notifications. As with
37 * other ListenerRegistration-based interfaces, registering an instance multiple times
38 * results in notifications being delivered for each registration.
40 * @param listener Notification instance to register
41 * @param types Notification types which should be delivered to the listener. Duplicate
42 * entries are processed only once, null entries are ignored.
43 * @return Registration handle. Invoking {@link DOMNotificationListenerRegistration#close()}
44 * will stop the delivery of notifications to the listener
45 * @throws IllegalArgumentException if types is empty or contains an invalid element, such as
46 * null or a SchemaPath which does not represent a valid {@link DOMNotification} type.
47 * @throws NullPointerException if listener is null
49 // FIXME: Java 8: provide a default implementation of this method.
50 DOMNotificationListenerRegistration registerNotificationListener(@Nonnull DOMNotificationListener listener, SchemaPath... types);