2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.mdsal.binding.api;
10 import org.opendaylight.mdsal.common.api.AsyncWriteTransaction;
11 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
13 import org.opendaylight.yangtools.yang.binding.DataObject;
14 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
17 * A transaction that provides mutation capabilities on a data tree.
20 * For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
22 public interface WriteTransaction extends AsyncWriteTransaction<InstanceIdentifier<?>, DataObject> {
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.
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.
34 * For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
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.
40 * the logical data store which should be modified
42 * the data object path
44 * the data object to be written to the specified path
45 * @throws IllegalStateException
46 * if the transaction has already been submitted
48 <T extends DataObject> void put(LogicalDatastoreType store, InstanceIdentifier<T> path, T data);
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
57 * For more information on usage and examples, please see the documentation
58 * in {@link AsyncWriteTransaction}.
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}
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.
71 * the logical data store which should be modified
73 * the data object path
75 * the data object to be written to the specified path
76 * @param createMissingParents
77 * if {@link #CREATE_MISSING_PARENTS}, any missing parent nodes will be automatically
78 * created using a merge operation.
79 * @throws IllegalStateException
80 * if the transaction has already been submitted
82 <T extends DataObject> void put(LogicalDatastoreType store, InstanceIdentifier<T> path, T data,
83 boolean createMissingParents);
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.
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.
96 * For more information on usage and examples, please see the documentation in
97 * {@link AsyncWriteTransaction}.
100 * If you require an explicit replace operation, use {@link #put} instead.
102 * the logical data store which should be modified
104 * the data object path
106 * the data object to be merged to the specified path
107 * @throws IllegalStateException
108 * if the transaction has already been submitted
110 <T extends DataObject> void merge(LogicalDatastoreType store, InstanceIdentifier<T> path, T data);
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.
118 * For more information on usage and examples, please see the documentation
119 * in {@link AsyncWriteTransaction}.
122 * If you require an explicit replace operation, use {@link #put} instead.
125 * the logical data store which should be modified
127 * the data object path
129 * the data object to be merged to the specified path
130 * @param createMissingParents
131 * if {@link #CREATE_MISSING_PARENTS}, any missing parent nodes will be automatically created
132 * using a merge operation.
133 * @throws IllegalStateException
134 * if the transaction has already been submitted
136 <T extends DataObject> void merge(LogicalDatastoreType store, InstanceIdentifier<T> path, T data,
137 boolean createMissingParents);
140 void delete(LogicalDatastoreType store, InstanceIdentifier<?> path);
143 * Flag value indicating that missing parents should be created.
145 boolean CREATE_MISSING_PARENTS = true;
148 * Flag value indicating that missing parents should cause an error.
150 boolean FAIL_ON_MISSING_PARENTS = false;