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.genius.infra;
10 import org.opendaylight.mdsal.binding.api.Transaction;
11 import org.opendaylight.mdsal.binding.api.WriteTransaction;
12 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
13 import org.opendaylight.yangtools.yang.binding.DataObject;
14 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
17 * Write transaction which is specific to a single logical datastore (configuration or operational). Designed for use
18 * with {@link ManagedNewTransactionRunner} (it doesn’t support explicit cancel or commit operations).
20 * @param <D> The logical datastore handled by the transaction.
21 * @see WriteTransaction
23 public interface TypedWriteTransaction<D extends Datastore> extends
26 * Writes an object to the given path.
28 * @see WriteTransaction#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 missing parents if requested.
39 * @see WriteTransaction#put(LogicalDatastoreType, InstanceIdentifier, DataObject)
41 * @param path The path to write to.
42 * @param data The object to write.
43 * @param createMissingParents {@link WriteTransaction#CREATE_MISSING_PARENTS} to create missing parents,
44 * {@link WriteTransaction#FAIL_ON_MISSING_PARENTS} to fail if parents are missing.
45 * @param <T> The type of the provided object.
47 <T extends DataObject> void put(InstanceIdentifier<T> path, T data, boolean createMissingParents);
50 * Merges an object with the data already present at the given path.
52 * @see WriteTransaction#merge(LogicalDatastoreType, InstanceIdentifier, DataObject)
54 * @param path The path to write to.
55 * @param data The object to merge.
56 * @param <T> The type of the provided object.
58 <T extends DataObject> void merge(InstanceIdentifier<T> path, T data);
61 * Merges an object with the data already present at the given path, creating missing parents if requested.
63 * @see WriteTransaction#merge(LogicalDatastoreType, InstanceIdentifier, DataObject)
65 * @param path The path to write to.
66 * @param data The object to merge.
67 * @param createMissingParents {@link WriteTransaction#CREATE_MISSING_PARENTS} to create missing parents,
68 * {@link WriteTransaction#FAIL_ON_MISSING_PARENTS} to fail if parents are missing.
69 * @param <T> The type of the provided object.
71 <T extends DataObject> void merge(InstanceIdentifier<T> path, T data, boolean createMissingParents);
74 * Deletes the object present at the given path.
76 * @see WriteTransaction#delete(LogicalDatastoreType, InstanceIdentifier)
78 * @param path The path to delete.
80 void delete(InstanceIdentifier<?> path);