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.spi.store;
10 import org.eclipse.jdt.annotation.NonNull;
11 import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeListener;
12 import org.opendaylight.yangtools.concepts.Registration;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
16 * Interface implemented by DOMStore implementations which allow registration of {@link DOMDataTreeChangeListener}
19 public interface DOMStoreTreeChangePublisher {
21 * Registers a {@link DOMDataTreeChangeListener} to receive notifications when data changes under a given path in
22 * the conceptual data tree.
25 * You are able to register for notifications for any node or subtree which can be represented using
26 * {@link YangInstanceIdentifier}.
29 * You are able to register for data change notifications for a subtree or leaf even if it does not exist. You will
30 * receive notification once that node is created.
33 * If there is any pre-existing data in data tree on path for which you are registering, you will receive initial
34 * data change event, which will contain all pre-existing data, marked as created. If the data at the supplied path
35 * does not exist, you will also receive initial data change event, which will contain empty data tree modification,
36 * marked as unmodified.
39 * This method returns a {@link Registration} object. To "unregister" your listener for changes call the
40 * {@link Registration#close()} method on this returned object.
43 * You MUST explicitly unregister your listener when you no longer want to receive
44 * notifications. This is especially true in OSGi environments, where failure to
45 * do so during bundle shutdown can lead to stale listeners being still registered.
47 * @param treeId Data tree identifier of the subtree which should be watched for changes.
48 * @param listener Listener instance which is being registered
49 * @return A {@link Registration} registration object, which may be used to unregister your listener using
50 * {@link Registration#close()} to stop delivery of change events.
52 @NonNull Registration registerTreeChangeListener(@NonNull YangInstanceIdentifier treeId,
53 @NonNull DOMDataTreeChangeListener listener);