2 * Copyright (c) 2015 Brocade Communications 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
8 package org.opendaylight.ovsdb.compatibility.plugin.impl;
10 import java.util.List;
11 import java.util.concurrent.ConcurrentMap;
12 import java.util.concurrent.ExecutionException;
14 import org.opendaylight.controller.sal.core.Node;
15 import org.opendaylight.controller.sal.utils.Status;
16 import org.opendaylight.ovsdb.compatibility.plugin.api.OvsdbConfigurationService;
17 import org.opendaylight.ovsdb.compatibility.plugin.api.StatusWithUuid;
18 import org.opendaylight.ovsdb.compatibility.plugin.error.OvsdbPluginException;
19 import org.opendaylight.ovsdb.lib.notation.Row;
20 import org.opendaylight.ovsdb.lib.notation.UUID;
21 import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
22 import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
25 * This is a proxy class for ovsdb plugin's OvsdbConfigurationService class
26 * It just forward the call to OvsdbConfigurationService instance and pass
27 * back the response to the caller.
29 * @author Anil Vishnoi (vishnoianil@gmail.com)
32 public class ConfigurationServiceImpl implements OvsdbConfigurationService
34 org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService pluginOvsdbConfigurationService;
40 * Function called by the dependency manager when at least one dependency
41 * become unsatisfied or when the component is shutting down because for
42 * example bundle is being stopped.
49 * Function called by dependency manager after "init ()" is called and after
50 * the services provided by the class are registered in the service registry
57 * Function called by the dependency manager before the services exported by
58 * the component are unregistered, this will be followed by a "destroy ()"
65 public void setOvsdbConfigurationService(org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService pluginOvsdbConfigurationService){
66 this.pluginOvsdbConfigurationService = pluginOvsdbConfigurationService;
69 public void unsetOvsdbConfigurationService(org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService pluginOvsdbConfigurationService){
70 if(this.pluginOvsdbConfigurationService != null)
71 this.pluginOvsdbConfigurationService = null;
76 public StatusWithUuid insertRow(Node node, String tableName, String parentUuid, Row<GenericTableSchema> row) {
77 return StatusConvertorUtil.convertOvsdbStatusWithUuidToCompLayerStatusWithUuid(pluginOvsdbConfigurationService.insertRow(node, tableName, parentUuid, row));
81 public Status updateRow (Node node, String tableName, String parentUUID, String rowUUID, Row row) {
82 return StatusConvertorUtil.convertOvsdbStatusToSalStatus(pluginOvsdbConfigurationService.updateRow(node, tableName, parentUUID, rowUUID, row));
86 public Status deleteRow(Node node, String tableName, String uuid) {
87 return StatusConvertorUtil.convertOvsdbStatusToSalStatus(pluginOvsdbConfigurationService.deleteRow(node, tableName, uuid));
91 public ConcurrentMap<String, Row> getRows(Node node, String tableName) {
92 return pluginOvsdbConfigurationService.getRows(node, tableName);
96 public Row getRow(Node node, String tableName, String uuid) {
97 return pluginOvsdbConfigurationService.getRow(node, tableName, uuid);
101 public List<String> getTables(Node node) {
102 return pluginOvsdbConfigurationService.getTables(node);
106 public Boolean setOFController(Node node, String bridgeUUID) throws InterruptedException, ExecutionException {
107 return pluginOvsdbConfigurationService.setOFController(node, bridgeUUID);
111 public <T extends TypedBaseTable<?>> String getTableName(Node node, Class<T> typedClass) {
112 return pluginOvsdbConfigurationService.getTableName(node, typedClass);
116 public <T extends TypedBaseTable<?>> T getTypedRow(Node node, Class<T> typedClass, Row row) {
117 return pluginOvsdbConfigurationService.getTypedRow(node, typedClass, row);
121 public <T extends TypedBaseTable<?>> T createTypedRow(Node node, Class<T> typedClass) {
122 return pluginOvsdbConfigurationService.createTypedRow(node, typedClass);
126 public UUID insertRow(Node node, String databaseName, String tableName, String parentTable, UUID parentUuid,
127 String parentColumn, Row<GenericTableSchema> row) throws OvsdbPluginException {
128 return pluginOvsdbConfigurationService.insertRow(node, databaseName, tableName, parentTable, parentUuid,
133 public UUID insertRow(Node node, String databaseName, String tableName,
134 UUID parentRowUuid, Row<GenericTableSchema> row)
135 throws OvsdbPluginException {
136 return this.insertRow(node, databaseName, tableName, null, parentRowUuid, null, row);
140 public Row<GenericTableSchema> insertTree(Node node, String databaseName, String tableName, String parentTable, UUID parentUuid,
141 String parentColumn, Row<GenericTableSchema> row) throws OvsdbPluginException {
142 return pluginOvsdbConfigurationService.insertTree(node, databaseName, tableName, parentTable, parentUuid, parentColumn, row);
146 public Row<GenericTableSchema> insertTree(Node node, String databaseName,
147 String tableName, UUID parentRowUuid, Row<GenericTableSchema> row)
148 throws OvsdbPluginException {
149 return this.insertTree(node, databaseName, tableName, null, parentRowUuid, null, row);
153 public Row<GenericTableSchema> updateRow(Node node, String databaseName,
154 String tableName, UUID rowUuid, Row<GenericTableSchema> row,
155 boolean overwrite) throws OvsdbPluginException {
156 return pluginOvsdbConfigurationService.updateRow(node, databaseName, tableName, rowUuid, row, overwrite);
160 public void deleteRow(Node node, String databaseName, String tableName, String parentTable, UUID parentRowUuid,
161 String parentColumn, UUID rowUuid) throws OvsdbPluginException {
162 pluginOvsdbConfigurationService.deleteRow(node, databaseName, tableName, parentTable, parentRowUuid, parentColumn, rowUuid);
166 public void deleteRow(Node node, String databaseName, String tableName, UUID rowUuid) throws OvsdbPluginException {
167 this.deleteRow(node, databaseName, tableName, null, null, null, rowUuid);
171 public Row<GenericTableSchema> getRow(Node node, String databaseName,
172 String tableName, UUID uuid) throws OvsdbPluginException {
173 return pluginOvsdbConfigurationService.getRow(node, databaseName, tableName, uuid);
177 public ConcurrentMap<UUID, Row<GenericTableSchema>> getRows(Node node,
178 String databaseName, String tableName) throws OvsdbPluginException {
179 return pluginOvsdbConfigurationService.getRows(node, databaseName, tableName);
183 public ConcurrentMap<UUID, Row<GenericTableSchema>> getRows(Node node,
184 String databaseName, String tableName, String fiqlQuery)
185 throws OvsdbPluginException {
186 return this.getRows(node, databaseName, tableName);
190 public List<String> getTables(Node node, String databaseName) throws OvsdbPluginException {
191 return pluginOvsdbConfigurationService.getTables(node, databaseName);