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