2 * Copyright © 2018 Red Hat, Inc. and others.
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.util;
10 import com.google.common.annotations.Beta;
11 import org.opendaylight.mdsal.binding.api.Transaction;
12 import org.opendaylight.mdsal.binding.api.WriteOperations;
13 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
14 import org.opendaylight.yangtools.yang.binding.DataObject;
15 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
18 * Write transaction which is specific to a single logical datastore (configuration or operational). Designed for use
19 * with {@link ManagedNewTransactionRunner} (it doesn’t support explicit cancel or commit operations).
21 * @param <D> The logical datastore handled by the transaction.
22 * @see WriteOperations
24 public interface TypedWriteTransaction<D extends Datastore> extends Transaction {
26 * Writes an object to the given path.
28 * @see WriteOperations#put(LogicalDatastoreType, InstanceIdentifier, DataObject)
30 * @param path The path to write to.
31 * @param data The object to write.
32 * @param <T> The type of the provided object.
34 <T extends DataObject> void put(InstanceIdentifier<T> path, T data);
37 * Writes an object to the given path, creating significant parents, like presence containers and list entries,
40 * @see WriteOperations#mergeParentStructurePut(LogicalDatastoreType, InstanceIdentifier, DataObject)
42 * @param path The path to write to.
43 * @param data The object to write.
44 * @param <T> The type of the provided object.
46 // TODO: can we come up with a better name?
48 <T extends DataObject> void mergeParentStructurePut(InstanceIdentifier<T> path, T data);
51 * Merges an object with the data already present at the given path.
53 * @see WriteOperations#merge(LogicalDatastoreType, InstanceIdentifier, DataObject)
55 * @param path The path to write to.
56 * @param data The object to merge.
57 * @param <T> The type of the provided object.
59 <T extends DataObject> void merge(InstanceIdentifier<T> path, T data);
62 * Merges an object with the data already present at the given path, creating missing parents if requested.
64 * @see WriteOperations#merge(LogicalDatastoreType, InstanceIdentifier, DataObject)
66 * @param path The path to write to.
67 * @param data The object to merge.
68 * @param <T> The type of the provided object.
70 // TODO: can we come up with a better name?
72 <T extends DataObject> void mergeParentStructureMerge(InstanceIdentifier<T> path, T data);
75 * Deletes the object present at the given path.
77 * @see WriteOperations#delete(LogicalDatastoreType, InstanceIdentifier)
79 * @param path The path to delete.
81 void delete(InstanceIdentifier<?> path);