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