Merge changes I28d517fe,Ia6f0b6ce
[controller.git] / opendaylight / md-sal / sal-dom-spi / src / main / java / org / opendaylight / controller / sal / core / spi / data / DOMStore.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.sal.core.spi.data;
9
10 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
11 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
12 import org.opendaylight.controller.md.sal.common.api.data.DataChangeListener;
13 import org.opendaylight.yangtools.concepts.ListenerRegistration;
14 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
16
17 public interface DOMStore {
18
19     /**
20      *
21      * Creates a read only transaction
22      *
23      * @return
24      */
25     DOMStoreReadTransaction newReadOnlyTransaction();
26
27     /**
28      * Creates write only transaction
29      *
30      * @return
31      */
32     DOMStoreWriteTransaction newWriteOnlyTransaction();
33
34     /**
35      * Creates Read-Write transaction
36      *
37      * @return
38      */
39     DOMStoreReadWriteTransaction newReadWriteTransaction();
40
41     /**
42      * Registers {@link DataChangeListener} for Data Change callbacks
43      * which will be triggered on the change of provided subpath. What
44      * constitutes a change depends on the @scope parameter.
45      *
46      * Listener upon registration receives an initial callback
47      * {@link AsyncDataChangeListener#onDataChanged(org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent)}
48      * which contains stable view of data tree at the time of registration.
49      *
50      * @param path Path (subtree identifier) on which client listener will be invoked.
51      * @param listener Instance of listener which should be invoked on
52      * @param scope Scope of change which triggers callback.
53      * @return Listener Registration object, which client may use to close registration
54      *         / interest on receiving data changes.
55      *
56      */
57     <L extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L> registerChangeListener(
58             InstanceIdentifier path, L listener, DataChangeScope scope);
59
60 }