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.common.api.data;
13 import org.opendaylight.yangtools.concepts.Immutable;
14 import org.opendaylight.yangtools.concepts.Path;
18 * An event which contains a capture of changes in a data subtree
21 * Represents a notification indicating that some data at or under a particular
22 * path has changed. The notification contains a capture of the changes in the data
23 * subtree. This event is triggered by successful application of modifications
24 * from a transaction on the global data tree. Use the
25 * {@link AsyncDataBroker#registerDataChangeListener(LogicalDatastoreType, Path, AsyncDataChangeListener, AsyncDataBroker.DataChangeScope)}
26 * method to register a listener for data change events.
29 * A listener will only receive notifications for changes to data under the path
30 * they register for. See
31 * {@link AsyncDataBroker#registerDataChangeListener(LogicalDatastoreType, Path, AsyncDataChangeListener, AsyncDataBroker.DataChangeScope)}
32 * to learn more about registration scopes.
35 * The entire subtree under the path will be provided via instance methods of Data
36 * Change Event even if just a leaf node changes.
39 * <b>Implementation Note:</b> This interface is not intended to be implemented
40 * by users of MD-SAL, but only to be consumed by them.
43 * Type of path (subtree identifier), which represents location in
46 * Type of data (payload), which represents data payload
48 public interface AsyncDataChangeEvent<P extends Path<P>, D> extends Immutable {
50 * Returns a map of paths and newly created objects, which were introduced by
51 * this change into conceptual data tree, if no new objects were introduced
52 * this map will be empty.
54 * This map contains all data tree nodes (and paths to them) which were created
55 * and are in the scope of listener registration. The data tree nodes
56 * contain their whole subtree with their current state.
58 * @return map of paths and newly created objects
60 Map<P, D> getCreatedData();
63 * Returns a map of paths and objects which were updated by this change in the
64 * conceptual data tree if no existing objects were updated
65 * this map will be empty.
67 * This map contains all data tree nodes (and paths to them) which were updated
68 * and are in the scope of listener registration. The data tree nodes
69 * contain their whole subtree with their current state.
71 * A Node is considered updated if it contents were replaced or one of its
72 * children was created, removed or updated.
74 * Original state of the updated data tree nodes is in
75 * {@link #getOriginalData()} stored with same path.
77 * @return map of paths and newly created objects
79 Map<P, D> getUpdatedData();
82 * Returns an immutable set of removed paths.
84 * This set contains the paths to the data tree nodes which are in the scope
85 * of the listener registration that have been removed.
87 * Original state of the removed data tree nodes is in
88 * {@link #getOriginalData()} stored with same path.
90 * @return set of removed paths
92 Set<P> getRemovedPaths();
95 * Returns an immutable map of updated or removed paths and their original
96 * states prior to this change.
99 * This map contains the original version of the data tree nodes (and paths
100 * to them), which are in the scope of the listener registration.
102 * @return map of paths and original state of updated and removed objects.
104 Map<P, ? extends D> getOriginalData();
107 * Returns an immutable stable view of data state, which captures the state of
108 * data store before the reported change.
111 * The view is rooted at the point where the listener, to which the event is
112 * being delivered, was registered.
114 * If listener used a wildcarded path (if supported by path type) during
115 * registration for change listeners this method returns null, and original
116 * state can be accessed only via {@link #getOriginalData()}
118 * @return Stable view of data before the change happened, rooted at the
119 * listener registration path.
122 D getOriginalSubtree();
125 * Returns an immutable stable view of data, which captures the state of data
126 * store after the reported change.
128 * The view is rooted at the point where the listener, to which the event is
129 * being delivered, was registered.
131 * If listener used a wildcarded path (if supported by path type) during
132 * registration for change listeners this method returns null, and state
133 * can be accessed only via {@link #getCreatedData()},
134 * {@link #getUpdatedData()}, {@link #getRemovedPaths()}
136 * @return Stable view of data after the change happened, rooted at the
137 * listener registration path.
139 D getUpdatedSubtree();