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