2 * Copyright (c) 2016 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
9 package org.opendaylight.mdsal.binding.api;
11 import com.google.common.util.concurrent.CheckedFuture;
12 import javax.annotation.Nonnull;
13 import javax.annotation.Nullable;
14 import org.opendaylight.mdsal.common.api.TransactionCommitFailedException;
15 import org.opendaylight.yangtools.yang.binding.DataObject;
18 * Write transaction that provides cursor's with write access to the data tree.
20 public interface CursorAwareWriteTransaction extends DataTreeCursorProvider {
23 * Create a {@link DataTreeWriteCursor} anchored at the specified path.
24 * There can only be one cursor open at a time.
27 * @param path Path at which the cursor is to be anchored
28 * @return write cursor at the desired location.
29 * @throws IllegalStateException when there's an open cursor, or this transaction is closed already.
33 <T extends DataObject> DataTreeWriteCursor createCursor(@Nonnull DataTreeIdentifier<T> path);
36 * Cancels the transaction.
39 * Transactions can only be cancelled if it was not yet submited.
42 * Invoking cancel() on failed or already canceled will have no effect, and transaction is
43 * considered cancelled.
46 * Invoking cancel() on finished transaction (future returned by {@link #submit()} already
47 * successfully completed) will always fail (return false).
49 * @return <tt>false</tt> if the task could not be cancelled, typically because it has already
50 * completed normally; <tt>true</tt> otherwise
56 * Submits this transaction to be asynchronously applied to update the logical data tree. The
57 * returned CheckedFuture conveys the result of applying the data changes.
60 * <b>Note:</b> It is strongly recommended to process the CheckedFuture result in an
61 * asynchronous manner rather than using the blocking get() method.
64 * This call logically seals the transaction, which prevents the client from further changing
65 * data tree using this transaction's cursor. Any subsequent calls to
66 * <code>createCursorCursor(DOMDataTreeIdentifier</code>
67 * or any of the cursor's methods will fail with {@link IllegalStateException}.
70 * The transaction is marked as submitted and enqueued into the shard back-end for
73 CheckedFuture<Void,TransactionCommitFailedException> submit();