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.controller.md.sal.binding.api;
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;
16 * 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 * @deprecated Use {@link org.opendaylight.mdsal.binding.api.WriteTransaction} instead.
23 @Deprecated(forRemoval = true)
24 public interface WriteTransaction extends AsyncWriteTransaction<InstanceIdentifier<?>, DataObject> {
26 * Stores a piece of data at the specified path. This acts as an add / replace operation, which is to say that whole
27 * subtree will be replaced by the specified data.
30 * This method does not automatically create missing parent nodes. It is equivalent to invoking
31 * {@link #put(LogicalDatastoreType, InstanceIdentifier, DataObject, boolean)} with {@code createMissingParents} set
35 * For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
38 * If you need to make sure that a parent object exists but you do not want modify its pre-existing state by using
39 * put, consider using {@link #merge} instead.
41 * @param store the logical data store which should be modified
42 * @param path the data object path
43 * @param data the data object to be written to the specified path
44 * @throws IllegalStateException if the transaction has already been submitted
46 <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 / replace operation, which is to say that whole
50 * subtree will be replaced by the specified data.
53 * For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
56 * If you need to make sure that a parent object exists but you do not want modify its pre-existing state by using
57 * put, consider using {@link #merge} instead.
60 * Note: Using <code>createMissingParents</code> with value true, may introduce garbage in data store, or recreate
61 * nodes, which were deleted by previous transaction.
63 * @param store the logical data store which should be modified
64 * @param path the data object path
65 * @param data the data object to be written to the specified path
66 * @param createMissingParents if {@link #CREATE_MISSING_PARENTS} ({@code true}), any missing parent nodes will be
67 * automatically created using a merge operation.
68 * @throws IllegalStateException if the transaction has already been submitted
70 <T extends DataObject> void put(LogicalDatastoreType store, InstanceIdentifier<T> path, T data,
71 boolean createMissingParents);
74 * Merges a piece of data with the existing data at a specified path. Any pre-existing data which is not explicitly
75 * overwritten will be preserved. This means that if you store a container, its child lists will be merged.
78 * This method does not automatically create missing parent nodes. It is equivalent to invoking
79 * {@link #merge(LogicalDatastoreType, InstanceIdentifier, DataObject, boolean)} with {@code createMissingParents}
83 * For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
86 * If you require an explicit replace operation, use {@link #put} instead.
88 * @param store the logical data store which should be modified
89 * @param path the data object path
90 * @param data the data object to be merged to the specified path
91 * @throws IllegalStateException if the transaction has already been submitted
93 <T extends DataObject> void merge(LogicalDatastoreType store, InstanceIdentifier<T> path, T data);
96 * Merges a piece of data with the existing data at a specified path. Any pre-existing data which is not explicitly
97 * overwritten will be preserved. This means that if you store a container, its child lists will be merged.
100 * For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
103 * If you require an explicit replace operation, use {@link #put} instead.
105 * @param store the logical data store which should be modified
106 * @param path the data object path
107 * @param data the data object to be merged to the specified path
108 * @param createMissingParents if {@link #CREATE_MISSING_PARENTS} ({@code true}), any missing parent nodes will be
109 * automatically created using a merge operation.
110 * @throws IllegalStateException if the transaction has already been submitted
112 <T extends DataObject> void merge(LogicalDatastoreType store, InstanceIdentifier<T> path, T data,
113 boolean createMissingParents);
116 void delete(LogicalDatastoreType store, InstanceIdentifier<?> path);
119 * Flag value indicating that missing parents should be created.
121 boolean CREATE_MISSING_PARENTS = true;
124 * Flag value indicating that missing parents should cause an error.
126 boolean FAIL_ON_MISSING_PARENTS = false;