2 * Copyright (c) 2015 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.EventListener;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
16 * Interface implemented by classes interested in receiving notifications about data tree changes. It provides
17 * a cursor-based view of the change.
19 public interface DOMDataTreeChangeListener extends EventListener {
21 * Invoked when there was data change for the supplied path, which was used to register this listener.
24 * This method may be also invoked during registration of the listener if there is any pre-existing data
25 * in the conceptual data tree for supplied path. This initial event will contain all pre-existing data as created.
28 * Note: If there is no pre-existing data, the method {@link #onInitialData} will be invoked.
31 * A data change event may be triggered spuriously, e.g. such that data before and after compare as equal.
32 * Implementations of this interface are expected to recover from such events. Event producers are expected to exert
33 * reasonable effort to suppress such events. In other words, it is completely acceptable to observe
34 * a {@link org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode}, which reports
35 * a {@link org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType} other than UNMODIFIED, while
36 * the before- and after- data items compare as equal.
38 * @param changes Collection of change events, may not be null or empty.
39 * @throws NullPointerException if {@code changes} is null
41 void onDataTreeChanged(@NonNull Collection<DataTreeCandidate> changes);
44 * Invoked only once during registration of the listener if there was no data in the conceptual data tree
45 * for the supplied path, which was used to register this listener, and after this
46 * {@link #onDataTreeChanged(Collection)} would always be invoked for data changes.
49 * Default implementation does nothing and is appropriate for users who do not care about ascertaining
52 default void onInitialData() {