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 org.eclipse.jdt.annotation.NonNullByDefault;
11 import org.opendaylight.yangtools.concepts.Registration;
14 * A {@link DOMDataBroker.Extension} which allows users to register for changes to a subtree.
17 public interface DOMDataTreeChangeService extends DOMDataBroker.Extension {
19 * Registers a {@link DOMDataTreeChangeListener} to receive notifications when data changes under a given path in
20 * the conceptual data tree.
23 * You are able to register for notifications for any node or subtree which can be represented using
24 * {@link DOMDataTreeIdentifier}.
27 * You are able to register for data change notifications for a subtree or leaf even if it does not exist. You will
28 * receive notification once that node is created.
31 * If there is any pre-existing data in the data tree for the path for which you are registering, you will receive
32 * an initial data change event, which will contain all pre-existing data, marked as created.
35 * This method returns a {@link Registration} object. To "unregister" your listener for changes call
36 * the {@link Registration#close()} method on the returned object.
39 * You MUST explicitly unregister your listener when you no longer want to receive notifications. This is especially
40 * true in OSGi environments, where failure to do so during bundle shutdown can lead to stale listeners being still
43 * @param treeId Data tree identifier of the subtree which should be watched for changes.
44 * @param listener Listener instance which is being registered
45 * @return A {@link Registration} object, which may be used to unregister your listener using
46 * {@link Registration#close()} to stop delivery of change events.
47 * @throws NullPointerException if any of the arguments is null
49 Registration registerDataTreeChangeListener(DOMDataTreeIdentifier treeId, DOMDataTreeChangeListener listener);