Deprecate all MD-SAL APIs
[controller.git] / opendaylight / md-sal / sal-binding-api / src / main / java / org / opendaylight / controller / md / sal / binding / api / WriteTransaction.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.binding.api;
9
10 import org.opendaylight.controller.md.sal.common.api.data.AsyncWriteTransaction;
11 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
12 import org.opendaylight.yangtools.yang.binding.DataObject;
13 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
14
15 /**
16  * A transaction that provides mutation capabilities on a data tree.
17  *
18  * <p>
19  * For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
20  *
21  * @deprecated Use {@link org.opendaylight.mdsal.binding.api.WriteTransaction} instead.
22  */
23 @Deprecated
24 public interface WriteTransaction extends AsyncWriteTransaction<InstanceIdentifier<?>, DataObject> {
25
26     /**
27      * Stores a piece of data at the specified path. This acts as an add / replace
28      * operation, which is to say that whole subtree will be replaced by the specified data.
29      * * <p>
30      * This method does not automatically create missing parent nodes. It is equivalent to invoking
31      * {@link #put(LogicalDatastoreType, InstanceIdentifier, DataObject, boolean)}
32      * with <code>createMissingParents</code> set to false.
33      * <p>
34      * For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
35      * <p>
36      * If you need to make sure that a parent object exists but you do not want modify
37      * its pre-existing state by using put, consider using {@link #merge} instead.
38      *
39      * @param store
40      *            the logical data store which should be modified
41      * @param path
42      *            the data object path
43      * @param data
44      *            the data object to be written to the specified path
45      * @throws IllegalStateException
46      *             if the transaction has already been submitted
47      */
48     <T extends DataObject> void put(LogicalDatastoreType store, InstanceIdentifier<T> path, T data);
49
50
51     /**
52      * Stores a piece of data at the specified path. This acts as an add /
53      * replace operation, which is to say that whole subtree will be replaced by
54      * the specified data.
55      * <p>
56      * For more information on usage and examples, please see the documentation
57      * in {@link AsyncWriteTransaction}.
58      * <p>
59      * If you need to make sure that a parent object exists but you do not want
60      * modify its pre-existing state by using put, consider using {@link #merge}
61      * instead.
62      *
63      * Note: Using <code>createMissingParents</code> with value true, may
64      * introduce garbage in data store, or recreate nodes, which were deleted by
65      * previous transaction.
66      *
67      * @param store
68      *            the logical data store which should be modified
69      * @param path
70      *            the data object path
71      * @param data
72      *            the data object to be written to the specified path
73      * @param createMissingParents
74      *            if {@link #CREATE_MISSING_PARENTS} ({@code true}), any missing
75      *            parent nodes will be automatically created using a merge
76      *            operation.
77      * @throws IllegalStateException
78      *             if the transaction has already been submitted
79      */
80     <T extends DataObject> void put(LogicalDatastoreType store, InstanceIdentifier<T> path, T data,
81             boolean createMissingParents);
82
83     /**
84      * Merges a piece of data with the existing data at a specified path. Any pre-existing data
85      * which is not explicitly overwritten will be preserved. This means that if you store a container,
86      * its child lists will be merged.
87      * <p>
88      * This method does not automatically create missing parent nodes. It is equivalent to invoking
89      * {@link #merge(LogicalDatastoreType, InstanceIdentifier, DataObject, boolean)}
90      * with <code>createMissingParents</code> set to false.
91      * <p>
92      * For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
93      *<p>
94      * If you require an explicit replace operation, use {@link #put} instead.
95      * @param store
96      *            the logical data store which should be modified
97      * @param path
98      *            the data object path
99      * @param data
100      *            the data object to be merged to the specified path
101      * @throws IllegalStateException
102      *             if the transaction has already been submitted
103      */
104     <T extends DataObject> void merge(LogicalDatastoreType store, InstanceIdentifier<T> path, T data);
105
106     /**
107      * Merges a piece of data with the existing data at a specified path. Any
108      * pre-existing data which is not explicitly overwritten will be preserved.
109      * This means that if you store a container, its child lists will be merged.
110      * <p>
111      * For more information on usage and examples, please see the documentation
112      * in {@link AsyncWriteTransaction}.
113      * <p>
114      * If you require an explicit replace operation, use {@link #put} instead.
115      *
116      * @param store
117      *            the logical data store which should be modified
118      * @param path
119      *            the data object path
120      * @param data
121      *            the data object to be merged to the specified path
122      * @param createMissingParents
123      *            if {@link #CREATE_MISSING_PARENTS} ({@code true}), any missing
124      *            parent nodes will be automatically created using a merge
125      *            operation.
126      * @throws IllegalStateException
127      *             if the transaction has already been submitted
128      */
129     <T extends DataObject> void merge(LogicalDatastoreType store, InstanceIdentifier<T> path, T data,
130             boolean createMissingParents);
131
132     @Override
133     void delete(LogicalDatastoreType store, InstanceIdentifier<?> path);
134
135     /**
136      * Flag value indicating that missing parents should be created.
137      */
138     boolean CREATE_MISSING_PARENTS = true;
139
140     /**
141      * Flag value indicating that missing parents should cause an error.
142      */
143     boolean FAIL_ON_MISSING_PARENTS = false;
144 }