Clean up documentation
[mdsal.git] / dom / mdsal-dom-api / src / main / java / org / opendaylight / mdsal / dom / api / DOMDataTreeChangeService.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 org.eclipse.jdt.annotation.NonNullByDefault;
11 import org.opendaylight.yangtools.concepts.Registration;
12
13 /**
14  * A {@link DOMDataBroker.Extension} which allows users to register for changes to a subtree.
15  */
16 @NonNullByDefault
17 public interface DOMDataTreeChangeService extends DOMDataBroker.Extension {
18     /**
19      * Registers a {@link DOMDataTreeChangeListener} to receive notifications when data changes under a given path in
20      * the conceptual data tree.
21      *
22      * <p>
23      * You are able to register for notifications for any node or subtree which can be represented using
24      * {@link DOMDataTreeIdentifier}.
25      *
26      * <p>
27      * You are able to register for data change notifications for a subtree or leaf even if it does not exist. You will
28      * receive notification once that node is created.
29      *
30      * <p>
31      * If there is any pre-existing data in the data tree for the path for which you are registering, you will receive
32      * an initial data change event, which will contain all pre-existing data, marked as created.
33      *
34      * <p>
35      * This method returns a {@link Registration} object. To "unregister" your listener for changes call
36      * the {@link Registration#close()} method on the returned object.
37      *
38      * <p>
39      * You MUST explicitly unregister your listener when you no longer want to receive notifications. This is especially
40      * true in OSGi environments, where failure to do so during bundle shutdown can lead to stale listeners being still
41      * registered.
42      *
43      * @param treeId Data tree identifier of the subtree which should be watched for changes.
44      * @param listener Listener instance which is being registered
45      * @return A {@link Registration} object, which may be used to unregister your listener using
46      *         {@link Registration#close()} to stop delivery of change events.
47      * @throws NullPointerException if any of the arguments is {@code null}
48      */
49     Registration registerDataTreeChangeListener(DOMDataTreeIdentifier treeId, DOMDataTreeChangeListener listener);
50 }