Merge "Bug 1100 - Invoking an RPC with no input should not throw 500 when expected"
[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.controller.md.sal.common.api.data.TransactionChain;
14 import org.opendaylight.yangtools.concepts.ListenerRegistration;
15 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
16 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
17
18 /**
19  * DOM Data Store
20  *
21  * <p>
22  * DOM Data Store provides transactional tree-like storage for YANG-modeled
23  * entities described by YANG schema and represented by {@link NormalizedNode}.
24  *
25  * Read and write access to stored data is provided only via transactions
26  * created using {@link #newReadOnlyTransaction()},
27  * {@link #newWriteOnlyTransaction()} and {@link #newReadWriteTransaction()}, or
28  * by creating {@link TransactionChain}.
29  *
30  */
31 public interface DOMStore extends DOMStoreTransactionFactory {
32
33     /**
34      * Registers {@link DataChangeListener} for Data Change callbacks which will
35      * be triggered on the change of provided subpath. What constitutes a change
36      * depends on the @scope parameter.
37      *
38      * Listener upon registration receives an initial callback
39      * {@link AsyncDataChangeListener#onDataChanged(org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent)}
40      * which contains stable view of data tree at the time of registration.
41      *
42      *  @param path Path (subtree identifier) on which client listener will be
43      * invoked.
44      *
45      * @param listener
46      *            Instance of listener which should be invoked on
47      * @param scope
48      *            Scope of change which triggers callback.
49      * @return Listener Registration object, which client may use to close
50      *         registration / interest on receiving data changes.
51      *
52      */
53     <L extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L> registerChangeListener(
54             InstanceIdentifier path, L listener, DataChangeScope scope);
55
56     /**
57      *
58      * Creates new transaction chain.
59      *
60      * Transactions in a chain need to be committed in sequence and each
61      * transaction should see the effects of previous transactions as if they
62      * happened.
63      *
64      * See {@link DOMStoreTransactionChain} for more information.
65      *
66      * @return Newly created transaction chain.
67      */
68     DOMStoreTransactionChain createTransactionChain();
69
70 }