Added a few convenience methods in plugin that can be used with or without passing... 78/10278/2
authorMadhu Venugopal <mavenugo@gmail.com>
Mon, 25 Aug 2014 01:31:47 +0000 (18:31 -0700)
committerMadhu Venugopal <mavenugo@gmail.com>
Tue, 26 Aug 2014 12:54:00 +0000 (05:54 -0700)
Change-Id: Iec11549178236efe5b1e5fa5d47b8de7e9b5f4e7
Signed-off-by: Madhu Venugopal <mavenugo@gmail.com>
plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/OvsdbConfigurationService.java
plugin/src/main/java/org/opendaylight/ovsdb/plugin/impl/ConfigurationServiceImpl.java

index 9a59f75df6f8eb1c0cc2a68c7d1c9a8911fd8a64..083acc0849a82b899ede6e8e594384960bb9b476 100644 (file)
@@ -41,7 +41,10 @@ public interface OvsdbConfigurationService {
     public StatusWithUuid insertRow(Node node, String tableName, String parentUuid, Row<GenericTableSchema> row);
 
     /**
-     * insert a Row in a Table of a specified Database Schema.
+     * insert a Row in a Table of a specified Database Schema. This is a convenience method on top of
+     * {@link insertRow(Node, String, String, String, UUID, String, Row<GenericTableSchema>) insertRow}
+     * which assumes that OVSDB schema implementation that corresponds to the databaseName will provide
+     * the necessary service to populate the Parent Table Name and Parent Column Name.
      *
      * This method can insert just a single Row specified in the row parameter.
      * But {@link #insertTree(Node, String, String, UUID, Row<GenericTableSchema>) insertTree}
@@ -55,7 +58,43 @@ public interface OvsdbConfigurationService {
      * @throws OvsdbPluginException Any failure during the insert transaction will result in a specific exception.
      * @return UUID of the inserted Row
      */
-    public UUID insertRow(Node node, String databaseName, String tableName, UUID parentUuid, Row<GenericTableSchema> row) throws OvsdbPluginException;
+    public UUID insertRow(Node node, String databaseName, String tableName, UUID parentRowUuid,
+                          Row<GenericTableSchema> row) throws OvsdbPluginException;
+
+    /**
+     * insert a Row in a Table of a specified Database Schema.
+     *
+     * This method can insert just a single Row specified in the row parameter.
+     * But {@link #insertTree(Node, String, String, UUID, Row<GenericTableSchema>) insertTree}
+     * can insert a hierarchy of rows with parent-child relationship.
+     *
+     * @param node OVSDB Node
+     * @param databaseName Database Name that represents the Schema supported by the node.
+     * @param tableName Table on which the row is inserted
+     * @param parentTable Name of the Parent Table to which this operation will result in attaching/mutating.
+     * @param parentUuid UUID of a Row in parent table to which this operation will result in attaching/mutating.
+     * @param parentColumn Name of the Column in the Parent Table to be mutated with the UUID that results from the insert operation.
+     * @param row Row of table Content to be inserted
+     * @throws OvsdbPluginException Any failure during the insert transaction will result in a specific exception.
+     * @return UUID of the inserted Row
+     */
+    public UUID insertRow(Node node, String databaseName, String tableName, String parentTable, UUID parentRowUuid,
+                          String parentColumn, Row<GenericTableSchema> row) throws OvsdbPluginException;
+
+    /**
+     * inserts a Tree of Rows in multiple Tables that has parent-child relationships referenced through the OVSDB schema's refTable construct.
+     * This is a convenience method on top of {@link #insertTree(Node, String, String, String, UUID, String, Row<GenericTableSchema>) insertTree}
+     *
+     * @param node OVSDB Node
+     * @param databaseName Database Name that represents the Schema supported by the node.
+     * @param tableName Table on which the row is inserted
+     * @param parentUuid UUID of a Row in parent table to which this operation will result in attaching/mutating.
+     * @param row Row Tree with parent-child relationships via column of type refTable.
+     * @throws OvsdbPluginException Any failure during the insert transaction will result in a specific exception.
+     * @return Returns the row tree with the UUID of every inserted Row populated in the _uuid column of every row in the tree
+     */
+    public Row<GenericTableSchema> insertTree(Node node, String databaseName, String tableName, UUID parentRowUuid,
+                                              Row<GenericTableSchema> row) throws OvsdbPluginException;
 
     /**
      * inserts a Tree of Rows in multiple Tables that has parent-child relationships referenced through the OVSDB schema's refTable construct
@@ -63,12 +102,15 @@ public interface OvsdbConfigurationService {
      * @param node OVSDB Node
      * @param databaseName Database Name that represents the Schema supported by the node.
      * @param tableName Table on which the row is inserted
-     * @param parentUuid UUID of the parent table to which this operation will result in attaching/mutating.
+     * @param parentTable Name of the Parent Table to which this operation will result in attaching/mutating.
+     * @param parentUuid UUID of a Row in parent table to which this operation will result in attaching/mutating.
+     * @param parentColumn Name of the Column in the Parent Table to be mutated with the UUID that results from the insert operation.
      * @param row Row Tree with parent-child relationships via column of type refTable.
      * @throws OvsdbPluginException Any failure during the insert transaction will result in a specific exception.
      * @return Returns the row tree with the UUID of every inserted Row populated in the _uuid column of every row in the tree
      */
-    public Row<GenericTableSchema> insertTree(Node node, String databaseName, String tableName, UUID parentUuid, Row<GenericTableSchema> row) throws OvsdbPluginException;
+    public Row<GenericTableSchema> insertTree(Node node, String databaseName, String tableName, String parentTable, UUID parentRowUuid,
+                                              String parentColumn, Row<GenericTableSchema> row) throws OvsdbPluginException;
 
     /**
      * @deprecated This version of updateRow is a short-term replacement for the older & now deprecated method of the same name.
@@ -127,6 +169,21 @@ public interface OvsdbConfigurationService {
 
     public void deleteRow (Node node, String databaseName, String tableName, UUID rowUuid) throws OvsdbPluginException;
 
+    /**
+     * update or mutate a Row in a Table of a specified Database Schema.
+     *
+     * @param node OVSDB Node
+     * @param databaseName Database Name that represents the Schema supported by the node.
+     * @param tableName Table on which the row is Updated
+     * @param parentTable Name of the Parent Table to which this operation will result in mutating.
+     * @param parentColumn Name of the Column in the Parent Table to be mutated.
+     * @param rowUuid UUID of the row that is being deleted
+     * @throws OvsdbPluginException Any failure during the delete operation will result in a specific exception.
+     */
+
+    public void deleteRow (Node node, String databaseName, String tableName, String parentTable,
+                           UUID parentRowUuid, String parentColumn, UUID rowUuid) throws OvsdbPluginException;
+
     /**
      * @deprecated This version of getRow is a short-term replacement for the older & now deprecated method of the same name.
      * This API assumes an Open_vSwitch database Schema.
index 63c57e2fbaab81f45daf145a85022a6132ebc8fd..56aea7e9fd0f89f008704d41f7a767bdc230174b 100644 (file)
@@ -1175,16 +1175,28 @@ public class ConfigurationServiceImpl implements IPluginInBridgeDomainConfigServ
         return null;
     }
 
+    @Override
+    public UUID insertRow(Node node, String databaseName, String tableName, String parentTable, UUID parentUuid,
+                          String parentColumn, Row<GenericTableSchema> row) throws OvsdbPluginException {
+        throw new OvsdbPluginException("Not implemented Yet");
+    }
+
     @Override
     public UUID insertRow(Node node, String databaseName, String tableName,
-            UUID parentUuid, Row<GenericTableSchema> row)
+            UUID parentRowUuid, Row<GenericTableSchema> row)
             throws OvsdbPluginException {
         throw new OvsdbPluginException("Not implemented Yet");
     }
 
+    @Override
+    public Row<GenericTableSchema> insertTree(Node node, String databaseName, String tableName, String parentTable, UUID parentRowUuid,
+                                              String parentColumn, Row<GenericTableSchema> row) throws OvsdbPluginException {
+        throw new OvsdbPluginException("Not implemented Yet");
+    }
+
     @Override
     public Row<GenericTableSchema> insertTree(Node node, String databaseName,
-            String tableName, UUID parentUuid, Row<GenericTableSchema> row)
+            String tableName, UUID parentRowUuid, Row<GenericTableSchema> row)
             throws OvsdbPluginException {
         throw new OvsdbPluginException("Not implemented Yet");
     }
@@ -1196,11 +1208,16 @@ public class ConfigurationServiceImpl implements IPluginInBridgeDomainConfigServ
         throw new OvsdbPluginException("Not implemented Yet");
     }
 
+    @Override
+    public void deleteRow(Node node, String databaseName, String tableName, String parentTable, UUID parentRowUuid,
+            String parentColumn, UUID rowUuid) throws OvsdbPluginException {
+        throw new OvsdbPluginException("Not implemented Yet");
+    }
+
     @Override
     public void deleteRow(Node node, String databaseName, String tableName,
             UUID rowUuid) throws OvsdbPluginException {
         throw new OvsdbPluginException("Not implemented Yet");
-
     }
 
     @Override