Support for listening to DocumentTree modifications.

Change-Id: Ibe7c67e6615f5a19fe4c4c7dea182e1a59dc5eea
diff --git a/core/api/src/main/java/org/onosproject/store/service/DocumentTree.java b/core/api/src/main/java/org/onosproject/store/service/DocumentTree.java
index ea7b014..72e10bf 100644
--- a/core/api/src/main/java/org/onosproject/store/service/DocumentTree.java
+++ b/core/api/src/main/java/org/onosproject/store/service/DocumentTree.java
@@ -102,4 +102,29 @@
      * @throws IllegalDocumentModificationException if the remove to be removed
      */
     V removeNode(DocumentPath key);
+
+    /**
+     * Registers a listener to be notified when a subtree rooted at the specified path
+     * is modified.
+     *
+     * @param path path to root of subtree to monitor for updates
+     * @param listener listener to be notified
+     */
+    void addListener(DocumentPath path, DocumentTreeListener<V> listener);
+
+    /**
+     * Unregisters a previously added listener.
+     *
+     * @param listener listener to unregister
+     */
+    void removeListener(DocumentTreeListener<V> listener);
+
+    /**
+     * Registers a listener to be notified when the tree is modified.
+     *
+     * @param listener listener to be notified
+     */
+    default void addListener(DocumentTreeListener<V> listener) {
+        addListener(root(), listener);
+    }
 }