Update DOMStoreThreePhaseCommitCohort design
[mdsal.git] / dom / mdsal-dom-spi / src / main / java / org / opendaylight / mdsal / dom / spi / store / DOMStoreTransactionFactory.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 /**
11  * Factory for DOM Store Transactions.
12  *
13  * <p>
14  * Factory provides method to construct read-only, read-write and write-only
15  * transactions, which may be used to retrieve and modify stored information in
16  * Underlying {@link DOMStore} or {@link DOMStoreTransactionChain}.
17  *
18  * <p>
19  * See {@link DOMStore} or {@link DOMStoreTransactionChain} for concrete
20  * variations of this factory.
21  *
22  * <p>
23  * <b>Note:</b> This interface is used only to define common functionality
24  * between {@link DOMStore} and {@link DOMStoreTransactionChain}, which
25  * further specify behaviour of returned transactions.
26  *
27  */
28 public interface DOMStoreTransactionFactory {
29
30     /**
31      * Creates a read only transaction.
32      *
33      * <p>
34      * Creates a new read-only transaction, which provides read access to
35      * snapshot of current state.
36      *
37      * <p>
38      * See {@link DOMStoreReadTransaction} for more information.
39      *
40      * @return new {@link DOMStoreReadTransaction}
41      * @throws IllegalStateException
42      *             If state of factory prevents allocating new transaction.
43      */
44     DOMStoreReadTransaction newReadOnlyTransaction();
45
46     /**
47      * Creates write only transaction.
48      *
49      * <p>
50      * See {@link DOMStoreWriteTransaction} for more information.
51      *
52      * @return new {@link DOMStoreWriteTransaction}
53      * @throws IllegalStateException If state of factory prevents allocating new transaction.
54      */
55     DOMStoreWriteTransaction newWriteOnlyTransaction();
56
57     /**
58      * Creates Read-Write transaction.
59      *
60      * <p>
61      * See {@link DOMStoreReadWriteTransaction} for more information.
62      *
63      * @return  new {@link DOMStoreWriteTransaction}
64      * @throws IllegalStateException If state of factory prevents allocating new transaction.
65      */
66     DOMStoreReadWriteTransaction newReadWriteTransaction();
67
68 }