- public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> event) {
-
- for (final Map.Entry<InstanceIdentifier<?>, DataObject> createdEntry : event.getCreatedData().entrySet()) {
- if (createdEntry.getValue() instanceof Node) {
- final Node node = (Node) createdEntry.getValue();
- LOG.debug("Create node...");
- if (getNodeIdRegexPattern().matcher(node.getNodeId().getValue()).matches()) {
- LOG.debug("Matched...");
- notifyNode(EventSourceTopology.EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class, node.getKey()));
- }
- }
- }
-
- for (final Map.Entry<InstanceIdentifier<?>, DataObject> changeEntry : event.getUpdatedData().entrySet()) {
- if (changeEntry.getValue() instanceof Node) {
- final Node node = (Node) changeEntry.getValue();
- if (getNodeIdRegexPattern().matcher(node.getNodeId().getValue()).matches()) {
- notifyNode(changeEntry.getKey());
- }
+ public void onDataTreeChanged(final Collection<DataTreeModification<Node>> changes) {
+ for (DataTreeModification<Node> change: changes) {
+ final DataObjectModification<Node> rootNode = change.getRootNode();
+ switch (rootNode.getModificationType()) {
+ case WRITE:
+ case SUBTREE_MODIFIED:
+ final Node node = rootNode.getDataAfter();
+ if (getNodeIdRegexPattern().matcher(node.getNodeId().getValue()).matches()) {
+ notifyNode(change.getRootPath().getRootIdentifier());
+ }
+ break;
+ default:
+ break;