Merge "Resolve Bug:522"
[controller.git] / opendaylight / md-sal / sal-common-api / src / main / java / org / opendaylight / controller / md / sal / common / api / data / AsyncDataBroker.java
1 /*
2  * Copyright (c) 2014 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.common.api.data;
9
10 import org.opendaylight.yangtools.concepts.ListenerRegistration;
11 import org.opendaylight.yangtools.concepts.Path;
12
13 public interface AsyncDataBroker<P extends Path<P>, D, L extends AsyncDataChangeListener<P, D>> extends //
14         AsyncDataTransactionFactory<P, D> {
15
16     /**
17      *
18      * Scope of Data Change
19      *
20      * Represents scope of data change (addition, replacement, deletion).
21      *
22      * The terminology for types is reused from LDAP
23      *
24      * @see http://www.idevelopment.info/data/LDAP/LDAP_Resources/SEARCH_Setting_the_SCOPE_Parameter.shtml
25      */
26     public enum DataChangeScope {
27
28        /**
29         * Represents only a direct change of the node, such as replacement of node,
30         * addition or deletion.
31         *
32         */
33        BASE,
34        /**
35         * Represent a change (addition,replacement,deletion)
36         * of the node or one of it's direct childs.
37         *
38         */
39        ONE,
40        /**
41         * Represents a change of the node or any of it's child nodes.
42         *
43         */
44        SUBTREE
45     }
46
47     @Override
48     public AsyncReadTransaction<P, D> newReadOnlyTransaction();
49
50     @Override
51     public AsyncReadWriteTransaction<P,D> newReadWriteTransaction();
52
53     @Override
54     public AsyncWriteTransaction<P, D> newWriteOnlyTransaction();
55
56     /**
57      * Registers {@link DataChangeListener} for Data Change callbacks
58      * which will be triggered on which will be triggered on the store
59      *
60      * @param store Logical store in which listener is registered.
61      * @param path Path (subtree identifier) on which client listener will be invoked.
62      * @param listener Instance of listener which should be invoked on
63      * @param triggeringScope Scope of change which triggers callback.
64      * @return Listener registration of the listener, call {@link ListenerRegistration#close()}
65      *         to stop delivery of change events.
66      */
67     ListenerRegistration<L> registerDataChangeListener(LogicalDatastoreType store, P path, L listener, DataChangeScope triggeringScope);
68 }