Migrate OSGI compendium reference
[controller.git] / opendaylight / md-sal / sal-dom-spi / src / main / java / org / opendaylight / controller / sal / core / spi / data / DOMStoreTreeChangePublisher.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.sal.core.spi.data;
9
10 import org.eclipse.jdt.annotation.NonNull;
11 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
12 import org.opendaylight.yangtools.concepts.ListenerRegistration;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
14
15 /**
16  * Interface implemented by DOMStore implementations which allow registration
17  * of {@link DOMDataTreeChangeListener} instances.
18  *
19  * @deprecated Use {@link org.opendaylight.mdsal.dom.spi.store.DOMStoreTreeChangePublisher} instead.
20  */
21 @Deprecated(forRemoval = true)
22 public interface DOMStoreTreeChangePublisher {
23     /**
24      * Registers a {@link DOMDataTreeChangeListener} to receive
25      * notifications when data changes under a given path in the conceptual data
26      * tree.
27      *
28      * <p>
29      * You are able to register for notifications  for any node or subtree
30      * which can be represented using {@link YangInstanceIdentifier}.
31      *
32      * <p>
33      * You are able to register for data change notifications for a subtree or leaf
34      * even if it does not exist. You will receive notification once that node is
35      * created.
36      *
37      * <p>
38      * If there is any pre-existing data in data tree on path for which you are
39      * registering, you will receive initial data change event, which will
40      * contain all pre-existing data, marked as created.
41      *
42      * <p>
43      * This method returns a {@link ListenerRegistration} object. To
44      * "unregister" your listener for changes call the {@link ListenerRegistration#close()}
45      * method on this returned object.
46      *
47      * <p>
48      * You MUST explicitly unregister your listener when you no longer want to receive
49      * notifications. This is especially true in OSGi environments, where failure to
50      * do so during bundle shutdown can lead to stale listeners being still registered.
51      *
52      * @param treeId
53      *            Data tree identifier of the subtree which should be watched for
54      *            changes.
55      * @param listener
56      *            Listener instance which is being registered
57      * @return Listener registration object, which may be used to unregister
58      *         your listener using {@link ListenerRegistration#close()} to stop
59      *         delivery of change events.
60      */
61     <L extends DOMDataTreeChangeListener> @NonNull ListenerRegistration<L> registerTreeChangeListener(
62             @NonNull YangInstanceIdentifier treeId, @NonNull L listener);
63 }