2 * Copyright (c) 2015 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.openflowplugin.api.openflow.device;
11 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
12 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
13 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException;
14 import org.opendaylight.yangtools.yang.binding.DataObject;
15 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
18 * Handles operations with transactions
20 public interface TxFacade {
23 * Method creates put operation using provided data in underlying transaction chain.
25 <T extends DataObject> void writeToTransaction(final LogicalDatastoreType store, final InstanceIdentifier<T> path,
26 final T data) throws TransactionChainClosedException;
29 * Method creates put operation using provided data in underlying transaction chain and flag to create missing parents
30 * WARNING: This method is slow because of additional reading cost. Use it only if you really need to create parents.
32 <T extends DataObject> void writeToTransactionWithParentsSlow(final LogicalDatastoreType store, final InstanceIdentifier<T> path,
33 final T data) throws TransactionChainClosedException;
36 * Method creates delete operation for provided path in underlying transaction chain.
38 <T extends DataObject> void addDeleteToTxChain(final LogicalDatastoreType store, final InstanceIdentifier<T> path) throws TransactionChainClosedException;
41 * Method submits Transaction to DataStore.
42 * @return transaction is submitted successfully
44 boolean submitTransaction();
47 * Method exposes transaction created for device
48 * represented by this context. This read only transaction has a fresh dataStore snapshot.
49 * There is a possibility to get different data set from DataStore
50 * as write transaction in this context.
51 * @return readOnlyTransaction - Don't forget to close it after finish reading
53 ReadOnlyTransaction getReadTransaction();