Switch to MD-SAL APIs
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / device / TxFacade.java
index e8a8ccb90449b48aa753e4654db84dc91823cdc2..79e033abbcd00ecc66ad8f5e378c35edadd4131e 100644 (file)
@@ -5,36 +5,37 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.openflowplugin.api.openflow.device;
 
-import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.mdsal.binding.api.ReadTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 /**
- * Handles operations with transactions
+ * Handles operations with transactions.
  */
 public interface TxFacade {
 
     /**
      * Method creates put operation using provided data in underlying transaction chain.
      */
-    <T extends DataObject> void writeToTransaction(final LogicalDatastoreType store, final InstanceIdentifier<T> path,
-                                                   final T data) throws Exception;
+    <T extends DataObject> void writeToTransaction(LogicalDatastoreType store, InstanceIdentifier<T> path, T data);
 
     /**
-     * Method creates put operation using provided data in underlying transaction chain and flag to create missing parents
-     * WARNING: This method is slow because of additional reading cost. Use it only if you really need to create parents.
+     * Method creates put operation using provided data in underlying transaction
+     * chain and flag to create missing parents.
+     * WARNING: This method is slow because of additional reading cost.
+     * Use it only if you really need to create parents.
      */
-    <T extends DataObject> void writeToTransactionWithParentsSlow(final LogicalDatastoreType store, final InstanceIdentifier<T> path,
-                                                                  final T data) throws Exception;
+    <T extends DataObject> void writeToTransactionWithParentsSlow(LogicalDatastoreType store,
+                                                                  InstanceIdentifier<T> path,
+                                                                  T data);
 
     /**
      * Method creates delete operation for provided path in underlying transaction chain.
      */
-    <T extends DataObject> void addDeleteToTxChain(final LogicalDatastoreType store, final InstanceIdentifier<T> path) throws Exception;
+    <T extends DataObject> void addDeleteToTxChain(LogicalDatastoreType store, InstanceIdentifier<T> path);
 
     /**
      * Method submits Transaction to DataStore.
@@ -42,6 +43,12 @@ public interface TxFacade {
      */
     boolean submitTransaction();
 
+    /**
+     * Method submits Transaction to DataStore and wait till completes by doing get on tx future.
+     * @return transaction is submitted successfully
+     */
+    boolean syncSubmitTransaction();
+
     /**
      * Method exposes transaction created for device
      * represented by this context. This read only transaction has a fresh dataStore snapshot.
@@ -49,5 +56,11 @@ public interface TxFacade {
      * as write transaction in this context.
      * @return readOnlyTransaction - Don't forget to close it after finish reading
      */
-    ReadOnlyTransaction getReadTransaction();
+    ReadTransaction getReadTransaction();
+
+    /**
+     * Method returns true if transaction chain manager is enabled.
+     * @return is transaction chain manager enabled
+     */
+    boolean isTransactionsEnabled();
 }