Refactor DOMYangTextSourceProvider
[mdsal.git] / dom / mdsal-dom-api / src / main / java / org / opendaylight / mdsal / dom / api / DOMDataTreeChangeListener.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 java.util.List;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidate;
13
14 /**
15  * Interface implemented by classes interested in receiving notifications about data tree changes. It provides
16  * a cursor-based view of the change.
17  */
18 public interface DOMDataTreeChangeListener {
19     /**
20      * Invoked when there was data change for the supplied path, which was used to register this listener.
21      *
22      * <p>
23      * This method may be also invoked during registration of the listener if there is any pre-existing data
24      * in the conceptual data tree for supplied path. This initial event will contain all pre-existing data as created.
25      *
26      * <p>
27      * Note: If there is no pre-existing data, the method {@link #onInitialData} will be invoked.
28      *
29      * <p>
30      * A data change event may be triggered spuriously, e.g. such that data before and after compare as equal.
31      * Implementations of this interface are expected to recover from such events. Event producers are expected to exert
32      * reasonable effort to suppress such events. In other words, it is completely acceptable to observe
33      * a {@link org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode}, which reports
34      * a {@link org.opendaylight.yangtools.yang.data.tree.api.ModificationType} other than UNMODIFIED, while
35      * the before- and after- data items compare as equal.
36      *
37      * @param changes List of change events, may not be null or empty.
38      * @throws NullPointerException if {@code changes} is null
39      */
40     void onDataTreeChanged(@NonNull List<DataTreeCandidate> changes);
41
42     /**
43      * Invoked only once during registration of the listener if there was no data in the conceptual data tree
44      * for the supplied path, which was used to register this listener, and after this
45      * {@link #onDataTreeChanged(List)} would always be invoked for data changes.
46      */
47     void onInitialData();
48 }