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