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.
19 * For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
21 public interface WriteTransaction extends AsyncWriteTransaction<InstanceIdentifier<?>, DataObject> {
24 * Stores a piece of data at the specified path. This acts as an add / replace
25 * operation, which is to say that whole subtree will be replaced by the specified data.
27 * This method does not automatically create missing parent nodes. It is equivalent to invoking
28 * {@link #put(LogicalDatastoreType, InstanceIdentifier, DataObject, boolean)}
29 * with <code>createMissingParents</code> set to false.
31 * For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
33 * If you need to make sure that a parent object exists but you do not want modify
34 * its pre-existing state by using put, consider using {@link #merge} instead.
37 * the logical data store which should be modified
39 * the data object path
41 * the data object to be written to the specified path
42 * @throws IllegalStateException
43 * if the transaction has already been submitted
45 <T extends DataObject> void put(LogicalDatastoreType store, InstanceIdentifier<T> path, T data);
49 * Stores a piece of data at the specified path. This acts as an add /
50 * replace operation, which is to say that whole subtree will be replaced by
53 * For more information on usage and examples, please see the documentation
54 * in {@link AsyncWriteTransaction}.
56 * If you need to make sure that a parent object exists but you do not want
57 * modify its pre-existing state by using put, consider using {@link #merge}
60 * Note: Using <code>createMissingParents</code> with value true, may
61 * introduce garbage in data store, or recreate nodes, which were deleted by
62 * previous transaction.
65 * the logical data store which should be modified
67 * the data object path
69 * the data object to be written to the specified path
70 * @param createMissingParents
71 * if true, any missing parent nodes will be automatically
72 * created using a merge operation.
73 * @throws IllegalStateException
74 * if the transaction has already been submitted
76 <T extends DataObject> void put(LogicalDatastoreType store, InstanceIdentifier<T> path, T data,
77 boolean createMissingParents);
80 * Merges a piece of data with the existing data at a specified path. Any pre-existing data
81 * which is not explicitly overwritten will be preserved. This means that if you store a container,
82 * its child lists will be merged.
84 * This method does not automatically create missing parent nodes. It is equivalent to invoking
85 * {@link #merge(LogicalDatastoreType, InstanceIdentifier, DataObject, boolean)}
86 * with <code>createMissingParents</code> set to false.
88 * For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
90 * If you require an explicit replace operation, use {@link #put} instead.
92 * the logical data store which should be modified
94 * the data object path
96 * the data object to be merged to the specified path
97 * @throws IllegalStateException
98 * if the transaction has already been submitted
100 <T extends DataObject> void merge(LogicalDatastoreType store, InstanceIdentifier<T> path, T data);
103 * Merges a piece of data with the existing data at a specified path. Any
104 * pre-existing data which is not explicitly overwritten will be preserved.
105 * This means that if you store a container, its child lists will be merged.
107 * For more information on usage and examples, please see the documentation
108 * in {@link AsyncWriteTransaction}.
110 * If you require an explicit replace operation, use {@link #put} instead.
113 * the logical data store which should be modified
115 * the data object path
117 * the data object to be merged to the specified path
118 * @param createMissingParents
119 * if true, any missing parent nodes will be automatically created
120 * using a merge operation.
121 * @throws IllegalStateException
122 * if the transaction has already been submitted
124 <T extends DataObject> void merge(LogicalDatastoreType store, InstanceIdentifier<T> path, T data,
125 boolean createMissingParents);
128 void delete(LogicalDatastoreType store, InstanceIdentifier<?> path);