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