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.yangtools.yang.binding.DataObject;
13 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
16 * Write transaction which is specific to a single logical datastore (configuration or operational). Designed for use
17 * with {@link ManagedNewTransactionRunner} (it doesn’t support explicit cancel or commit operations).
19 * @param <D> The logical datastore handled by the transaction.
20 * @see WriteTransaction
22 public interface TypedWriteTransaction<D extends Datastore> extends
25 * Writes an object to the given path.
27 * @see WriteTransaction#put(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType,
28 * 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(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType,
40 * InstanceIdentifier, DataObject, boolean)
42 * @param path The path to write to.
43 * @param data The object to write.
44 * @param createMissingParents {@link WriteTransaction#CREATE_MISSING_PARENTS} to create missing parents,
45 * {@link WriteTransaction#FAIL_ON_MISSING_PARENTS} to fail if parents are missing.
46 * @param <T> The type of the provided object.
48 <T extends DataObject> void put(InstanceIdentifier<T> path, T data, boolean createMissingParents);
51 * Merges an object with the data already present at the given path.
53 * @see WriteTransaction#merge(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType,
54 * InstanceIdentifier, DataObject)
56 * @param path The path to write to.
57 * @param data The object to merge.
58 * @param <T> The type of the provided object.
60 <T extends DataObject> void merge(InstanceIdentifier<T> path, T data);
63 * Merges an object with the data already present at the given path, creating missing parents if requested.
65 * @see WriteTransaction#merge(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType,
66 * InstanceIdentifier, DataObject, boolean)
68 * @param path The path to write to.
69 * @param data The object to merge.
70 * @param createMissingParents {@link WriteTransaction#CREATE_MISSING_PARENTS} to create missing parents,
71 * {@link WriteTransaction#FAIL_ON_MISSING_PARENTS} to fail if parents are missing.
72 * @param <T> The type of the provided object.
74 <T extends DataObject> void merge(InstanceIdentifier<T> path, T data, boolean createMissingParents);
77 * Deletes the object present at the given path.
79 * @see WriteTransaction#delete(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType,
82 * @param path The path to delete.
84 void delete(InstanceIdentifier<?> path);